fork download
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4. GDB online is an online compiler and debugger tool for C/C++.
  5. Code, Compile, Run and Debug online from anywhere in world.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include<stdio.h>
  10. #include <string.h>
  11.  
  12. #define NULL_PTR ((void *)0)
  13. void Spi_WriteIB(const int* const DataBufferPtr);
  14. void Spi_ReadIB(int* const DataBufferPointer);
  15.  
  16. const int* SrcBuffPtr = NULL_PTR;
  17. void Spi_WriteIB(const int* const DataBufferPtr)
  18. {
  19. if(DataBufferPtr != NULL_PTR)
  20. {
  21. SrcBuffPtr = *DataBufferPtr;
  22. printf("value writed = %d\n",SrcBuffPtr);
  23. }
  24. else
  25. {
  26. }
  27.  
  28. }
  29. void Spi_ReadIB(int* const DataBufferPointer)
  30. {
  31. *DataBufferPointer = SrcBuffPtr;
  32. // memcpy(DataBufferPointer,SrcBuffPtr,sizeof(SrcBuffPtr));
  33. printf("value read = %d\n",*DataBufferPointer);
  34. }
  35.  
  36. int main()
  37. {
  38. int const DataBuffer = 9;
  39. int const ReadDataBuffer = 0;
  40. Spi_WriteIB((int*)&DataBuffer);
  41. Spi_ReadIB((int*)&ReadDataBuffer);
  42.  
  43.  
  44.  
  45. }
Success #stdin #stdout 0s 5280KB
stdin
45
stdout
value writed = 9
value read = 9