cancel
Showing results for 
Search instead for 
Did you mean: 

2D array C program in UNIX

 
SOLVED
Go to solution
Highlighted
Henry Chua
Super Advisor

2D array C program in UNIX

Hi Guys,

Is it possible to use 2D array in C for UNIX? I am using 10.20b, but it doesnt recognise my declaration. Can this be solved?

Best regards
Henry
8 REPLIES 8
Highlighted
Orhan Biyiklioglu
Respected Contributor
Solution

Re: 2D array C program in UNIX

Could you give a bit more details about the problem. How do you declare the 2D array.

int myarr[2][2];

works for me

Regards
Highlighted
Alessandro Pilati
Esteemed Contributor

Re: 2D array C program in UNIX

Henry,
post your output;
On my server, this declaration runs:
char city[3][6] = -"milan", "rome", "naples""";

Cheers,
Alex
if you don't try, you'll never know if you are able to
Highlighted
Stephen Keane
Honored Contributor

Re: 2D array C program in UNIX

Henry,

do you want to use a 2D array in shell, like you can do in C? If so, bad news, the standard shell doesn't support it. You could use Perl (which does) though.

Highlighted
Muthukumar_5
Honored Contributor

Re: 2D array C program in UNIX

I hope that is because of compiler problem. what is compiler version.

what `which cc`

what is your example program? post this information.

hth.
Easy to suggest when don't know about the problem!
Highlighted
TwoProc
Honored Contributor

Re: 2D array C program in UNIX

Henry,

2D arrays have been part of the C compiler a looong time, so I'm pretty sure you've got a syntax error. Can you post the suspect lines of code, along with the error?
We are the people our parents warned us about --Jimmy Buffett
Highlighted
A. Clay Stephenson
Acclaimed Contributor

Re: 2D array C program in UNIX

C can handle n-dimensional arrays of simple and complex types (e.g. structs) but since you don't bother to post your declaration, it's difficult to help you veryu much.
If it ain't broke, I can fix that.
Highlighted
Henry Chua
Super Advisor

Re: 2D array C program in UNIX

Hi guy, I made a mistake in my declaration.. I have figure it out.. sorry for the trouble!
Highlighted
Henry Chua
Super Advisor

Re: 2D array C program in UNIX

thanks!