Struct type and memory
-
It is observed memory will be allocated for a structure only when a structure variable is declared. But when I tried this program, it printed address: #include struct emp{ int age; char name[30]; }emp1; main() { printf("%p is the address\n",&emp1.name); } Why ?
-
It is observed memory will be allocated for a structure only when a structure variable is declared. But when I tried this program, it printed address: #include struct emp{ int age; char name[30]; }emp1; main() { printf("%p is the address\n",&emp1.name); } Why ?
-
Because you have declared the variable
emp1
. As I have suggested to a number of other people recently, please get hold of a C language study guide and learn, at least, the basics of the language.Is it a generational thing? It seems more and more that folks are jumping right into chapter 7 of the book and then getting completely lost when things from the previous 6 chapters are being referenced and they can't understand why or where they came from. :rolleyes:
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Is it a generational thing? It seems more and more that folks are jumping right into chapter 7 of the book and then getting completely lost when things from the previous 6 chapters are being referenced and they can't understand why or where they came from. :rolleyes:
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
It seems to be, and we are seeing more and more of this type of question here. I guess they have all bought into the idea that you can make a lot of money as a developer with minimal training. Just pray they are not working at your bank or local hospital.