top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

what is meaning of return value in C language?

+3 votes
108 views
#include <stdio.h>
int main()
{
    char vowels[5]={'a','e','i','o','u'};
    int x;

    printf("Vowel Letters");
    for(x=0;x<=5;x++)
    {
         printf("\n %C",vowels[x]);
    }
}

Output

Vowel Letters
a
e
i
o
u
♣
Process exited after 0.1132 seconds with return value 3

What is the meaning of return value 3

posted Sep 21, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

You are trying to print 6 characters where as you are assigned only 5 to vowels[]. Since there is no array boundary check in C, it will print the garbage character in next byte. You can correct it by changing the for loop like:
for(x=0;x<5;x++)
or
for(x=0;x<=4;x++)

But how did you check the return value ?

answer Sep 23, 2015 by Shivananda Gavalkar S
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...