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

Facebook Login
Site Registration

C compilation error: expected expression before 'char'

+3 votes
186 views

I am newbie to C and getting the compilation error in the following function.

int get_names(int students, char names[students][20])
{
        int i;
        for (i = 0; i < students; ++i)
        {
                printf("Enter name for Student %d: ", i);
                scanf("%s", names[i]);
        }
        return char names[students];
}

Error:

return char names[students];
error: expected expression before 'char'
posted Sep 22, 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

Return statement does not require type name

Wrong

return char names[students];

Right Way

return names[students]; // No char
answer Sep 22, 2015 by Salil Agrawal
Similar Questions
0 votes

Recently I was dealing with some problems in Compiler design. What I want is a tool which can do step by step compilation of the C Program. One which performs lexical analysis and gives an output file and then syntax analysis on this output file and so on until the final executable code is obtained. Is there such a tool or technique to do this?

+1 vote

What type of conversion is not accepted in C and why?
a) char to int
b) float to char pointer
c) int to char
d) double to char

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
...