Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

when i run this code in online gdb it perfect but when i use stm32cube ide he gives me warning

+5 votes
asked May 13 by Rahul kumar Mahato (170 points)

/*

#include<stdint.h>

#include<stdio.h>

struct DataSet

{

char data1;

int data2;

char data3;

short data4;

};

int main(void)

{

struct DataSet data;

data.data1 =0x11;

data.data2 =0xFFFFEEEE;

data.data3 =0x22;

data.data4 =0xABCD;

uint8_t *ptr;

ptr = (uint8_t *)&data;

size_t totalSize = sizeof(struct DataSet); // Use size_t here

printf("Memory address content\n");

printf("=========================\n");

for (size_t i = 0; i < totalSize; i++) // Use size_t here

{

printf("%p , %x\n", ptr, *ptr);

ptr++;

}

printf("Total memory consumed by this struct variable = %lu\n", sizeof(struct DataSet));

getchar(); // Wait for user input

return 0;

}

1 Answer

0 votes
answered May 14 by Peter Minarik (88,520 points)
edited May 15 by Peter Minarik
What are the warnings you get? Exact message please, with the correct line numbers, if possible.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...