LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-19-2007, 04:49 AM   #1
kalleanka
Member
 
Registered: Aug 2003
Location: Mallorca, Spain
Distribution: xubuntu
Posts: 551

Rep: Reputation: 38
Array declaration?


Hi,


I use gtk and I have problem with a array declaration. I need to call gtk_label_new(const gchar * text)like this gtk_label_new(myarray[1,2]). So how do I declare the array?


It should be somthing like this!
gchar * myarray[2][2] = {{"ab","cd"},{"ef","gh"}};

Last edited by kalleanka; 11-19-2007 at 05:06 AM.
 
Old 11-19-2007, 05:08 AM   #2
kalleanka
Member
 
Registered: Aug 2003
Location: Mallorca, Spain
Distribution: xubuntu
Posts: 551

Original Poster
Rep: Reputation: 38
const gchar * mystr = "mystr";
works using mystr and with
const gchar * myarray[2][2] = {{"ab","cd"},{"ef","gh"}};
i get
warning: passing argument 1 of ‘gtk_label_new’ from incompatible pointer type
using myarray[2][1]

Last edited by kalleanka; 11-19-2007 at 05:24 AM.
 
Old 11-19-2007, 06:27 AM   #3
kalleanka
Member
 
Registered: Aug 2003
Location: Mallorca, Spain
Distribution: xubuntu
Posts: 551

Original Poster
Rep: Reputation: 38
ok my misstake


I was calling the arry like this myarray[1,2] when it should be like this myarry[1][2]
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C Global Declaration Aju Programming 3 09-29-2005 04:21 AM
the c declaration kapsikum Programming 3 04-06-2005 02:12 AM
Array declaration in class or main function??? redhatrosh Programming 4 03-15-2005 02:13 PM
Is there a default size limit to a dictionary, list or array declaration ? Linh Programming 2 06-08-2004 11:35 AM
PERL: Size of an array of an Array inspleak Programming 2 03-10-2004 02:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration