LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-03-2009, 06:51 AM   #1
SpLaSh212
Member
 
Registered: Mar 2006
Posts: 42

Rep: Reputation: 15
3 Questions about ANSI-C


Hey guys,
I have a few questions regarding ANSI-C
1. Can I change the indexes of an array to start from a different number (lets say from 1 and not from 0) so that
Code:
int arr[4]
will give me an array from arr[1] to arr[4] ?

2. Am I limited when I use "bit fields" to 8 bits max ?

3. Does the function fsize always prints file size ?

I'm suppose to write if its true/false or sometimes true and to explain why ...

Thnx alot!
 
Old 01-03-2009, 07:00 AM   #2
swodniw
Member
 
Registered: Jan 2006
Posts: 35

Rep: Reputation: 16
Quote:
I'm suppose to write if its true/false or sometimes true and to explain why ...
Please do not post your homework questions it is against the forum rules.
Thread reported for closure.
 
Old 01-03-2009, 09:34 AM   #3
SpLaSh212
Member
 
Registered: Mar 2006
Posts: 42

Original Poster
Rep: Reputation: 15
Ok, i'm sorry if its seems like copy & paste for me ...
but still, I would like that someone can lead me to the answer , help me with the search criteria ..
 
Old 01-03-2009, 09:49 AM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by SpLaSh212 View Post
I have a few questions regarding ANSI-C
The fact that those are harder to answer with a simple web search than typical homework questions may indicate your instructor has gone to some effort to select questions that test whether you have been paying attention in class.

I have not been paying attention in your class.

Quote:
1. Can I change the indexes of an array to start from a different number (lets say from 1 and not from 0)
I expect you have some documentation (text book, language reference manual, etc.) telling everything you're supposed to have learned about arrays. Reread that. See what you find.

Quote:
2. Am I limited when I use "bit fields" to 8 bits max ?
Same answer, but for "bit fields". Though that one may be easier to answer with google.

Quote:
3. Does the function fsize always prints file size ?
Which "function fsize"?

Maybe my question is your answer. But maybe my question was answered in class and is just the starting point for your answer. Again, I wasn't paying attention in your class.
 
Old 01-03-2009, 09:54 AM   #5
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quote:
I would like that someone can lead me to the answer , help me with the search criteria
Fair enough.
Quote:
1. Can I change the indexes of an array to start from a different number (lets say from 1 and not from 0) so that
Code:
int arr[4]
will give me an array from arr[1] to arr[4] ?
Any book or complete C tutorial will describe the conditions under which this can be done, if any. My favorite tutorial is here. If you use that, you may wish to start with the introductory class notes, and focus on Chapter 4.
Quote:
2. Am I limited when I use "bit fields" to 8 bits max ?
Try it out and see. Make one that's 9 bits long, cycle through all 512 values, and see whether they stick.
Quote:
3. Does the function fsize always prints file size ?
I guarantee you'll quickly find the answer to this one if you experiment with a fairly standard ANSI C compiler (gcc will do).

Hope this helps.
 
Old 01-03-2009, 10:14 AM   #6
SpLaSh212
Member
 
Registered: Mar 2006
Posts: 42

Original Poster
Rep: Reputation: 15
OK guys, thnx for the replies ...
I already found the answers to Q 2 & 3 ....
I wasn't that hard, I just want to do it simultaneity (google & here)

Regarding to Q 1, i'll check the posted link here,
I'm using Dennis Richie's ANSI C book, I'll re check there, bc I couldn't find anything about it the first time I was looking.

So again, thnx for the replies guys !
 
Old 01-03-2009, 10:28 AM   #7
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quote:
I just want to do it simultaneity (google & here)
That's just rude.
 
  


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
GNU C and ANSI C nesta Programming 11 01-20-2007 07:55 AM
ANSI and UTF8 questions kinetik Linux - General 2 09-11-2006 03:35 AM
Ansi Telnet thebutler4 Linux - Software 1 05-25-2004 12:58 PM
uninstalling ANSI C jogurt666 Debian 3 02-09-2004 09:10 AM
Is this ansi-c compliant? xailer Programming 5 12-26-2003 08:49 PM

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

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