ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ...
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 ..
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.
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).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.