How to use sizeof()?

Dec 13, 2014 at 2:26am
Where would i use sizeof() in my program? Would it be in the main body or in my function store_name? And would the code look like this: n = sizeof(child); or this int n = sizeof(child)/sizeof(info);

Last edited on Dec 13, 2014 at 3:21am
Dec 13, 2014 at 2:31am
Why do you think you need to use sizeof?
Dec 13, 2014 at 2:34am
I need to use it because in the rest of the program i find average of the three grades then find a letter grade for each student. When using only two students, the output prints for the two students but the rest of the output is filled with garbage values, which i don't want.
Last edited on Dec 13, 2014 at 2:35am
Dec 13, 2014 at 6:58am
That has nothing to do with sizeof.

If you have an open array of objects, you should also have a variable tracking the number of objects in that array.
Topic archived. No new replies allowed.