LinuxQuestions.org
Review your favorite Linux distribution.
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 04-13-2009, 06:48 PM   #1
acerlinux
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Rep: Reputation: 0
Q: C style string - Newbie question


I am pretty clear about what a C style string is and how it works, but my question here is why the following statement is legal:

typedef char TestUsername[30];

why the compiler will not complain about using char by not char*?
 
Old 04-13-2009, 07:48 PM   #2
Idle
LQ Newbie
 
Registered: Nov 2002
Location: Iceland
Distribution: RHEL, CentOS, Slackware
Posts: 26

Rep: Reputation: 15
Code:
// This is perfectly valid array of char typedef.
typedef char TestUsername[30];

// So is this, but of a [pointer to] array of char.
typedef char *TestUsername;
The compiler shouldn't complain about valid syntax.
 
Old 04-13-2009, 07:58 PM   #3
acerlinux
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Original Poster
Rep: Reputation: 0
yes yes, I see, Ignore my question here folks. My bad.
 
  


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
newbie c string question nomb Programming 9 03-16-2007 12:25 PM
Mounting a cruzer USB drive- newbie style VariableEnigma Mandriva 6 01-21-2005 03:48 PM
editing configs in woody - newbie style! trpost Debian 1 09-24-2004 01:30 PM
Major development-packages problem (newbie style) THX1138 Linux - Newbie 2 02-08-2004 06:24 PM
More newbie-style problems jin Linux - Newbie 3 01-07-2001 03:34 PM

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

All times are GMT -5. The time now is 09:16 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