<<thread split>>

#include <stdio.h>
struct a
        char aa;
        char ab;
        char ac;

struct b
        char b_a;
        char b_b;
        char b_c;
        char b_d;
        char b_e;
        char b_data[1];
int main()
struct b data_s;
struct a *req;
req  =(struct a* )data_s.b_data;
return 0;

Hi I am writing a Driver Code where the situation is like this as above.My doubt in this is that am I doing an array overflow here to the 'char variable b_data' ?? Can anyone please able to tell actually how the stack is getting populated in this case.Or is it a Stack Overflow ?? If I do "int ac" instead of "char ac" of "struct a" the program will crash in that case.I am thinking why is it so ??

I am a bit confused please help me out.The program is running successully in the OpenVMS Operating System.

Thanks in Advance,

Edited by Nick Evan: Added code-tags, split thread

Votes + Comments
Learn how to post a question and I may give it more attention.
7 Years
Discussion Span
Last Post by Adak

Welcome to the forum, Shubh. :)

A few important suggestions for you:

1) For your problem, start a new thread. Using someone else's is called "thread hijacking", and will get people upset with you.

More people will see your thread when you start a new one, and respond.

2) When you post code, ALWAYS highlight it and click on the # icon in the advanced editor, or "Code" word in the quick reply window. That makes your code keep good formatting on the forum. Hopefully, you use good formatting in your code, to help spot bugs and show the relationship between lines of code that are primary, and those that are dependent (indented 2 - 5 spaces).

Edited by Nick Evan: Fixed formatting

Votes + Comments
Barely contained restraint here ;)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.