~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

IF after Wolfpacks answer u still need to know how to find the position of any char in a char* array of chars then maybe this is wat u are looking for:

size_t strcspn( const char *str1, const char *str2 );

The function strcspn() returns the index of the first character in str1 that matches any of the characters in str2.

SO maybe

char* delimiter = "3";
char* myString = "1234567689";
int position = strcspn (myString, delimiter);

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Thanks a lot, i thought i would never get ans to this thing.

Anyways thanks for the book name and the big list both of you.

Regards,
~s.o.s~

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

LOL ok i agree.

I still think that you have got some things right there and i also have got some things right there. And that UML eg. was meant to show the difference between knowledge and the use of a particular tool.

And err...

UML is just a method for designing, the field is much narrower you don't 'create' with it. UML is UML is UML you can't create a 'poetic' UML diagram like you can with language.

Come on man.... UML and narrow. THey are more like antonyms. The history of software engg research has been more dedicated to software design and smart practices rather than on a particular language. If languages have power then UML is wat helps us in harness that power and make it available to the massses.

But still ALL PEACE.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

On this point I would argue if you have lots of knowledge, but no special knowledge you are in danger of becoming a Jack of all trades instead of a master craftsman. (this is my biggest problem I'm too interested in all of it to stick to a genre)

Come on my good friend, u mean to tell that by using a particular compiler or tool and using it perfectly crosses the thin line between Jack of All Trades and A Craftsman then i completely disagree.

Take for eg. the two UML tools Sparx Enterprise and Rational Rose. I completely agree that once you know what is where and the nifty tricks of the software then the productivity is definately boosted but it is no replacement of the knowledge of UML which is driving you to use the software. And suppose u have to switch to some other UML modeling tool then its the knowledge and understandign of UML which would save you and not the knowledge of a particular tool.

But this is just what i think...
Opinions may vary.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Why do you care about the speed anyways?

If the developers didnt care for speed then u wouldn't be conviniently using your favourite OS u are usign right now without atlest swearing atleast 100 times a day regarding the slow loading times.

Dont forget that this is a C/ C++ forum and speed is one of the major merits of this language and bcoz of which it is used to make real time softwares.

Though optimization should be last on ur list but it still is nevertheless an issue to be handled.

EDIT:
@hollystyles: btw 1 is a composite and 2 is a prime number

Here is a convinient and easy to understand way of fiding primes:

int isPrime (int number)
{
    if (number == 2)
        return 1;

    if (number % 2 == 0)
        return 0;

    for (int i = 3; i < number / 2; i += 2)
    {
        if ((number % i) == 0)
            return 0;
    }
    return 1;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I got 10 lines. ;)

#include <windows.h>
#include <iostream>
using namespace std;
int main(){
POINT c;
GetCursorPos(&c);
int x=c.x;
int y=c.y;
cout<<x<<", "<<y;
system("PAUSE");}

Dont say things without reading the entire post submitted by a very experienced and senior member.

What he wanted to said that if u intended on drawing a window or creating a window u need atleast 60 - 70 lines of code which is well formatted.

What u have written above is not a GUI or window application but a console application.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

char s[]="the cocaine man";
int i=0;
char ch;

ch=s[++i];
printf("%c ",ch);

You pre increment the value of " i " which now becomes 1 and u access ch = s [1] which is 'h' the second char of the array.

ch=s[i++];
printf("%c ",ch);

This time u use the post increment operator i ++ which causes the prev value of " i " to be used which is 1 and then increments it. So after this expression the value of i is now 2.

ch=i++[s];
printf("%c ",ch);

Arrays can be accesssed as arrayName [index] or index [arrayName] . For eg i can access an array as 3 [arrayName] = 'a'; which will set the fourth element of the array to character a.
Hence u use indirectly ch = 2 [s]; which is 'e'.
At this point the value of i becomes 3.

ch=++i[s];
printf("%c ",ch);

You now increment the ascii value of the character at position 3 which is a space ' '. The next character in the ASCII table after ' ' is ! hence the output.

output = h h e !


Hope it helped,
Bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

First of all, thanks for the sticky Mr. Dave.

Here is a list of some of the free books available on the net which should be present in the collection of each and every graphic programmer.

Free Game Programming ebooks ( general and Opengl related)

The openGL red book
http://www.opengl.org/documentation/red_book/

OpenGL programming guide
http://fly.srk.fer.hr/~unreal/theredbook/

Michael Abrash's Graphics Programming Black Book
http://public.planetmirror.com/pub/gpbb/

Waiting for the feedback of all you ppl.
Hope it helped.

Yours friend,
~s.o.s~

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Thanks for the feedback and i would really appreaciate if everyone would post any links to resources which are useful for C programmers so that they dont have to go any further than this thread.

hollystyles commented: Nice work to the hunter/gatherer of links +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

EDIT: Please note, as I write this, the post is now 6 years old and might have some outdated information. I'd personally recommend beginners start with "Learn C the hard way" by Zed and this book since I have heard good things about them. Reading the FAQ put together by the C newsgroup folks might be a good idea.

List of free compilers and IDE

1) Codeblocks IDE integrated with MINGW compiler can be downloaded at http://www.codeblocks.org/downloads.shtml

2) Visual Studio Express Edition

3) Pelles C IDE

List of Tutorials

C programming tutorials 4th edition
http://www.iu.hio.no/~mark/CTutorial/CTutorial.html#Preface

C standard function reference
http://www.cppreference.com
http://www.utas.edu.au/infosys/info/documentation/C/CStdLib.html#Contents

Excellent site for free compilers, libraries, tutorials etc.
http://www.thefreecountry.com/documentation/onlinereferences.shtml

C programming Notes
http://www.eskimo.com/~scs/cclass/notes/sx1.html

Programming in C
http://www.scit.wlv.ac.uk/~jphb/cbook/html/

Excellent site a must see for all newbies
http://www.cprogramming.com/tutorial.html
http://www.physics.drexel.edu/courses/Comp_Phys/General/C_basics/c_tutorial.html

Link to many programming tutorials
http://www.programmingtutorials.com/c.aspx
http://www.freeprogrammingresources.com/ctutor.html
http://www.tutorialized.com/tutorials/C-and-Cpp/1
http://www.techtutorials.info/cgen.html
http://www.intelligentedu.com/newly_researched_free_training/C.html
http://www.cyberdiem.com/vin/tutorials.html


Pointer and other topic specific resources
http://pweb.netcom.com/~tjensen/ptr/cpoint.htm
http://www.augustcouncil.com/~tgibson/tutorial/
http://www.newty.de/fpt/index.html

Advice and warnings for C
http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/

Interfacing ODBC and C
http://www.physics.drexel.edu/courses/Comp_Phys/General/C_basics/c_tutorial.html


- sos

Salem commented: Looking good +13
tux4life commented: Very nice :) +4
westsider123 commented: Thanks a lot! Really helpful! +0
alaa sam commented: Thanks a lot you really helped me to get started with c +0
\007 commented: Nice C guide~ +0
thendrluca commented: Usefull +0
Moschops commented: Bloodshed Dev C++ has become a bad choice in the last six years and needs removing. -2
Gribouillis commented: great thread +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

THanks to all you ppls help i finally managed to put the code together ( though using two arrays which i couldnt make to one :( )

Here is the code i am pasting here for others to have a reference.

[c]
#include "stdafx.h"
 
#include <stdio.h>

constint leftCorner = 3;
constint rightCorner = 4;
constint topElement = 2;
int *oldTriangle = 0;
int *newTriangle = 0;
void displayTriangle (int iteration)
{
if ((iteration % 2) == 1) 
{
for (int i = 1; i <= iteration; ++i)
printf ("%d ", oldTriangle[i-1]);
}
else
{
for (int i = 1; i <= iteration; ++i)
printf ("%d ", newTriangle[i-1]);
}
printf ("\n");
}
 
int buildTriangle (int tmpPascalRow)
{
int tmpRow, elementIndex;
int* src = NULL;
int* dest = NULL;
 
 
oldTriangle[0] = topElement;
displayTriangle (1);
if (tmpPascalRow == 1)
return 1;
 
newTriangle[0] = leftCorner;
newTriangle[1] = rightCorner;
displayTriangle (2);
if (tmpPascalRow == 2)
return 1;
 
for (tmpRow = 3; tmpRow <= tmpPascalRow; ++tmpRow)
{
if ((tmpRow % 2) == 1)
{
dest = oldTriangle;
src = newTriangle;
}
else
{
dest = newTriangle;
src = oldTriangle;
}
 
dest[0] = src[0];
dest[tmpRow-1] = src[tmpRow-2];
for (elementIndex = 1; elementIndex < tmpRow - 1; ++elementIndex)
{
dest[elementIndex] = src[elementIndex] + src[elementIndex - 1];
}
displayTriangle (tmpRow);
}
}
 
int main (void)
{
char inputBuffer[10];
int pascalRow = 0;
int index;
 
fputs ("Enter the number of rows required: ", stdout);
fgets (inputBuffer, sizeof (inputBuffer), stdin);
fflush (stdin);
pascalRow = atoi (inputBuffer);
newTriangle = (int*) calloc (pascalRow, sizeof (int));
oldTriangle = (int*) calloc (pascalRow, sizeof (int));
buildTriangle (pascalRow);
getchar();
return 0;
}
[/c]

THanks to all once again.

WolfPack commented: Thanks for posting the solution for others to refer. +2