/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C/C++.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include<stdio.h>
#include <string.h>
#define NULL_PTR ((void *)0)
void Spi_WriteIB(const int* const DataBufferPtr);
void Spi_ReadIB(int* const DataBufferPointer);
const int* SrcBuffPtr = NULL_PTR;
void Spi_WriteIB(const int* const DataBufferPtr)
{
if(DataBufferPtr != NULL_PTR)
{
SrcBuffPtr = *DataBufferPtr;
printf("value writed = %d\n",SrcBuffPtr
); }
else
{
}
}
void Spi_ReadIB(int* const DataBufferPointer)
{
*DataBufferPointer = SrcBuffPtr;
// memcpy(DataBufferPointer,SrcBuffPtr,sizeof(SrcBuffPtr));
printf("value read = %d\n",*DataBufferPointer
); }
int main()
{
int const DataBuffer = 9;
int const ReadDataBuffer = 0;
Spi_WriteIB((int*)&DataBuffer);
Spi_ReadIB((int*)&ReadDataBuffer);
}
LyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoKV2VsY29tZSB0byBHREIgT25saW5lLgpHREIgb25saW5lIGlzIGFuIG9ubGluZSBjb21waWxlciBhbmQgZGVidWdnZXIgdG9vbCBmb3IgQy9DKysuCkNvZGUsIENvbXBpbGUsIFJ1biBhbmQgRGVidWcgb25saW5lIGZyb20gYW55d2hlcmUgaW4gd29ybGQuCgoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwoKICNpbmNsdWRlPHN0ZGlvLmg+CiAjaW5jbHVkZSA8c3RyaW5nLmg+CiAKI2RlZmluZSBOVUxMX1BUUiAoKHZvaWQgKikwKQogdm9pZCBTcGlfV3JpdGVJQihjb25zdCBpbnQqIGNvbnN0IERhdGFCdWZmZXJQdHIpOwogdm9pZCBTcGlfUmVhZElCKGludCogY29uc3QgRGF0YUJ1ZmZl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