Jump to content
xisto Community
longtimeago

Ponters In C how to master it ?

Recommended Posts

Generally everyone says C is the basic of all languages and if you see C its really interesting and this is where people learn all the basic fundas like loops etc. But here in C we have the most and the damn important concept that is Pointers, and i dont know why but im sure it confuses people . I am not sure it is because of the hype created by people saying that pointers is tough or i dont know whether is it really tough ? So does any one know any simple and easy way to master pointers in C ?? please dont tell me the importance of pointers and such stuffs. I am sure everyone will be knowing the theoritical part behind pointers. when it comes to coding part it confuses people, So if you know some Big time methods to master pointers , just put it out ...

Share this post


Link to post
Share on other sites

I maybe offtopic to start with but C and C++ is hyped in india so much, and so are pointers. Besides that people in india still use TurboC++ 3.0 even if it is outdated by more than decade now. It is not confirming to standards to call it up-to-date. Coming back to topic, pointers is quite confusing for people. Besides those puzzles on pointers makes newbies more confused about pointers. It's better to avoid puzzles at start. Good project that uses pointers could help.

Well until and unless you use pointers in any of your project be it small or large, you'll not understand the benefit of it. Why don't you try some project that uses pointers heavily. This will help you understand it's usage as well as when to use and when to avoid that. Let me point you to some resources that could help. Some good methods scattered in here.

1. Digital mars Pointers reference.
2. Poiters in C tutorial (pdf)
3. C book (Pointers chapter).

Share this post


Link to post
Share on other sites

@ mahesh2k , thank you for those resources , Suggest me a good title which will involve much of pointer concepts ? have you done any projects which focuses on pointer concepts ??

Share this post


Link to post
Share on other sites

Yeah, professor in my university gave our group one such small project. I may not have it on this PC as of now. I can upload it on Scribd and link it later so that you can view that.

Share this post


Link to post
Share on other sites

@mahesh2k

Hi!

I know what you mean about people using Turbo C++ for learning C or C++. It has more to do with being able to find faculty to teach C and C++. Besides, with educators focusing more on the language itself than on the development environment, they don't really have specific guidelines about using Visual C++, Borland C++, GNU GCC/Cygwin, or some other software.

I think educators ought to demonstrate different software and enable the students to choose what they find the best. In a classroom of learners, there's quite a bit of exchange that gets learners sharing ideas and thoughts about the tools that they use for development. I remember a Java class I taught which had a mix of NetBeans, Eclipse, Borland JDeveloper, and others who used a text editor with a compiler.

Programming puzzles seem more appealing because they are short and give an idea of the different forms of C and C++ programs, some of which can be very cryptic. (Remember the obfuscated C code challenge?).

Pointers are not really hard to understand if you can put them in context. Distinguishing between arrays and pointers, rather than simply demonstrating an example that replaces arrays with pointers, is needed as a part of a chapter on pointers.

Here are some of the articles that I could find online about pointers:
GBDirect C Book: http://global.gbdirect.co.uk/http_error/404.html
Taranet Pointers: http://forums.xisto.com/no_longer_exists/
DuraMecho "Why C Has Pointers": http://duramecho.com/ComputerInformation/WhyCPointers.html

Share this post


Link to post
Share on other sites

Hi, All,On my view, the hard part the pointer is you need to consider when you have to dereference itand how it will be when doing calculation such + and - based-on type you are working on.I would suggest this is step for learning pointer.1. pointer basis2. single dimension pointer3. do same projects using pure pointer as possible. i.e don't use array at all. Such as passing it to function etc.4. multple dimension pointer such char **argv (i.e. pointer to pointer)5. same as 36. working both at the same time as 37. try to use 3, or 4 level of pointer to pointer. This is one of example that might be good for single dimension pointer.Build a simple chat client-server char apps if you already knew how socket work.It should be able issues command etc.Also, I read these book for learning pointer.C in a nutshellprieme C plus

Share this post


Link to post
Share on other sites

@ mahesh , thank pdf file is too good. I really appreicate the author of that Pdf document. There he has explained it soo clearly. He has explained it in simple steps and he has let that tutorial out. The motive of the author is let out in preface and i am really glad to learn from a tutorial written by such people. Hats off to Ted Jensen. I was surprised to look at where he began his profession and how come he has mastered Pointers.

Share this post


Link to post
Share on other sites

How to write to files in CPonters In C

TheProblem:

QuiteOften in programming, we have to read and write to files. The type ofFile is determined by the extension on it. For example, files withExtension ?.Txt? are text files, ?.Doc? are word files,?.Xls? are excel files.

YouAre required to write a C program that will be able to sieveDifferent types of numbers and write them in appropriate files. WeShall use three files file_even which is a word document, file_oddWhich is a text document and file_prime which is an excel file.

UsingThe integers from 1 to 500,

  • Write all even files with their halves in file_even. Every even number should be on its own line and a number is separated from its half with a tab.

  • Write all odd numbers with their squares in file_odd. Every odd number should be on its own line and it is separated from its square with a tab

  • Write all prime numbers and their thirds (rounded to 2 decimal places) in file_prime. Every prime number should be on its own line and a prime number and its third should be in separate cells (equivalent of tabs)

 

-reply by Norman Aine

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.