ah, ok, I didn't know that ...
Type: Posts; User: kermitaner
ah, ok, I didn't know that ...
just a few hints:
double more[n-1]; //array variable in struct
doesn't work, because at compile time n doesn't contain a valid value, better use
double more[10]; //array variable in struct
...
well, interesting task ;)
what is being asked is clear:
how to do this ? first u have to read the input file line by line. then u have to process each line char by char and collect chars into a...
safe&simple( should work for any non empty string :-) :
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int count[256]={0},i=0;
int max=0;
char maxchar;
...
well, this is not difficult.
take paper and pencil. write down the content of c and pc, after processing one byte after the other from the input string.
while ((c = getchar()) != EOF) {
reads...
simply processing char by char ;)
#include<stdio.h>
#include<stdlib.h>
void parseKeywords(char keyword[3][30]){
char *orig = "0=up,1=down,2=side*";
char* kp=NULL;
int pos=0;
hi,
u should first work out in our mind ( or on paper :p ) how ur program is supposed to work:
u put ur ships in an 10x10 char array.
a position that contains a ship is marked with an...
hello,
the method Adak showed, is of course a better solution.
however for practicing reasons u should try to change the code yourself, first put the reading loop of the second file in the outer...
first the (my :) ) solution:
i = -1;
while ( ++i < 4 )
printf( "while: i=%d\n", i );
the while loop is evaluated at the beginning (head ) .
i made the while loop start at -1 so the...
hm, i didn't know a function for this, so i wrote my own :)
#include <stdio.h>
#include <stdlib.h>
/* converts string of valid hex chars ('XX' : '0'-'9','A'-'F' )
to 1 byte char array with...
#include<stdio.h>
void pError(char * s){
printf("%s\n",s);
system("pause");
exit(1);
}
int main(){
int det_strings=0;
i get the same output, but its correct.
a float in memory has a different structure than an integer.
the printf("%x",int) means, take the 4 bytes at the ints address and treat them like they...
int i=255;
printf("%x\n",i);
even gives me 2 "ff" ;)
maybe u should try another compiler...
no, printf can do this:
printf("%x\n",15);
should give you a nice little "f"
there were just 2 errors in the orig. code, 1st the already mentioned summing up in the tmp var, second the obo ( off by one :-) error in the for loop:
#include <stdio.h>
int main(int argc,...