75 Posted Topics
Hey its me again i dunno this string stuff gonna drive me insane really been doing since yesterday exercises on string did half of them but i have this program which should remove chars that i specify and when i test with putchar it does remove them but The string … | |
Hello i m suppose to make a function that fetch the strings according to num and it will stop when num is finished or it encounter , or ' ' or newline i made the function but its acting weird as if there is a \0 placed in [code] #include … | |
Re: why are you using nested loop why dont u first fill the array with rand and make another temp array to hold the variables with same size and do another for loop to chk if that array[i]==temp[i] if its = then just rand() and its better to use srand(GetTickCount()); produces … | |
well i alawys wondered when i make char name[]="bla"; and count by ptr it doesnt work it says cant count wrong argument to increment but see whenever i like make it a function like void putit(char *Name); it work i dunno why though why does it work then if its … | |
Re: i think you can do this for the ; thing u do a list with stuff that doesnt have have ;(that is if it has more than 1 line) like for example for while if else if etc then after that if its not in the list chk the last … | |
Re: a pie char you must use graphics function or maybe like draw one by * but that will get somewhat confusing because u have to make it according to your % stuff | |
hello i m given a question in book i m reading that i copy element but using ptr to copy and other choice will be using normal integers to copy i did normal integer but copy i think i got a problem with it [code] #include <stdio.h> int copyarr(const int … | |
hey guys i know its kinda noobish not to understand them since i been coding for 1 month but there rlly some stuff which confuses me in multidimensional array and nested loops like here in this program I wanted to know if i sum up like in the array for … | |
Re: why dont you research an algothrim for image i think zip and one other is open source | |
Hey i m reading tutrial about rucursion and got code whish isnt complicated or anything but i dunno why it prints the way it does [code] /* recur.c -- recursion illustration */ #include <stdio.h> void up_and_down(int); int main(void) { up_and_down(1); return 0; } void up_and_down(int n) { printf("Level %d: n … | |
Re: also if your using win its better to use dev or msv6 | |
in my switch program keeps reading wrong input also i know i used way too much fflush(stdin); because stupid printf keeps inputting to the screen so scanf gets bad but i m sure i desinged program nice i dunno why when i like enter num 5 it keeps reading artichokes … | |
Re: why dont you put an array with stuff you want and extract that to new array? | |
hello i coding a program that need to sum array according to its num like for example num[0] will only do that and num[1] sum[1]=num[0] +num[1]; sum[2]=num[0] +num[1] +num[2]; etc i got one idea first i will fill the num array with numbers then i go through after that with … | |
Hello people i got a h.w to do Using nested loops to produce the following pattern: F FE FED FEDC FEDCB FEDCBA I had idea to do it but that will require array and strlen(char first int of the outer loop) and the thing says that I must do it … | |
okay i understand all bitwise operators but in the chapter of k&r at bitwise operators i m really lost at there question i have no idea how to do them Exercise 2-6. Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to … | |
Re: c right ? and you want to assign them to a buffer? | |
Re: here example if you wanna read 3 characters [code] #include <stdio.h> #define REQUIRED 3 int main(void) { char name[]="NAME"; int i; for(i=0; i<REQUIRED ;i++) printf("%c",name[i]); //or if you want read full name for(i=0;name[i]!=0;i++)//read untill null terminator is reached printf("%c",name[i]); getchar( ); return 0; } [/code] remeber it will only read … | |
Re: why dont you use strstr then use its return value to print that line ? | |
Re: average =sum/howmany why dont you after you read the array davide the array directly by i instead of just writing up the number yourself will make it more compact | |
Hello i m reading chapter in K&R about bit operation whish totally confuses me i understand what all operators does but i dont understand the code itself [code] unsigned getbits(unsigned x, int p, int n) { return (x >> (p+1-n)) & ~(~0 << n); } [/code] it will right shift … | |
i dunno im sure this output the good result i dont understand why it got not the output that i want [code] #include <stdio.h> void Squeeze2(char *str,char *save) { int i,x; int buffer=0;//used to save stuff for( i=0 , x=0 ; str[i]!=0 && save[x]!=0 ; i++, x++ ) { if( … | |
i m trying to code htoi function in chapter 2.3 for K&R but problem i dunno where to start should i first read all string then after that change each character to its decimal and then add them ? or any better ideas? | |
I m trying to find the biggest number in the array but problem is that it keeps returning one [code] #include <stdio.h> int FindBiggest(int *arr,int choice) { int i; int num=0; for(i=0;arr[i]<=sizeof arr;i++) { if(num<arr[i]) num=arr[i]; } return num; } int main(void) { int arr[]={0,5,3}; int result; result=FIND_NUM(arr,BIGGEST); printf("%d\n",result); getchar(); … |
The End.