strange C syntax

I have come across a C syntax in which there is no return value for the functions and the arrays seem to be initialized strangely as well. Not how I've been taught to write C programs but it compiles fine, what is the reason for that?

A code example would be:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

char array[] = "abcdef"
               "ghijkl"
               "mnopqr";

func()
{
    //  insert some code here
}

main()
{
    // insert some code here e.g. func();
}
Last edited on
I believe some compilers will automatically make a function return 'int' if nothing is declared.
Assignment of char arrays from string literals is supported by both C and C++.
Omitting the return type of a function is standard C and is not permissible in C++. (In C, if left
unspecified, the return type defaults to int).


The unspecified arguments mean pass anything in C, but means void, no arguments, in C++.
> The unspecified arguments mean pass anything in C, but means void, no arguments, in C++.

I guess that is just backwards compatibility? I don't see a way of accesing the passed argument.

(Well I could get it, non-portably, and it's more effort than it's worth...)
Topic archived. No new replies allowed.