15,552 Topics
| |
[code]#include<stdio.h> #include<stdlib.h> main(){ char *tab; int n; int i; char c; printf("dimension du tableau?"); scanf("%d",&n); tab=(char*)malloc(n*sizeof(char)); printf("remplir le tableau :"); fflush(stdin); gets(tab); for(i=0;tab[i]!='\0';i++){ printf("%c",tab[i]); } }[/code] let's say i just want 5 letters in tab,so i run the program and put n=5,but what i don't get is that if i … | |
[code]#include<stdio.h> #include<stdlib.h> #include<string.h> struct name { int a; char b[10]; char c; }; int main() { struct name *p; p = (struct name *)malloc(3 * sizeof(struct name)); char *n; n = "12345"; n = (char *)p; n = (int*)n; /*this is not correct . in doubt....change correctly*/ strcpy(n+(sizeof(p->a)),"ALL"); *(n+sizeof(p->a)+sizeof(p->b)) = … | |
The aim of the program is to add ten numbers then output their sum. I can do this but in a very basic way. for instance the only way I know how to do this is by adding each array and thats quite tedious and long is there any way … | |
I've been developing console applications using C/C++. I now want to move on and create some GUI applications. For that i saw some libraries to create GUI. I think those libraries are OS dependent. How can we create GUI applications compatible with Linux, Windows and Mac, or is it even … | |
{ int i = 25789; char *p; .............. .............. printf("%d",*p); /* (*p) should give in printf*/ } dont assign p=i ............apart from this how we can typecast this program so that we can get interger value tp pointer p.............please help me this | |
i would like to know how i mean when i scan image how it is transfer to computer in basic .aslo can i know the code scan file or image. | |
Hi everyone! So can someone explain me how to compile a file with gcc? I'm using kubuntu, and I've written my source code in Kate(the text editor), and I saved it in documents like file1, and now how to compile it from the terminal? I've tried with the command: [code] … | |
I'm trying to make a program,it's almost done... but i'm stuck on an error message that I get. I would appreciate any help. The error message: [QUOTE]error: conflicting types for ‘findEntry’ note: previous implicit declaration of ‘findEntry’...LINE 15[/QUOTE] I get it for this code: [CODE] catalogPointer findEntry(catalogPointer head, char names[]) … | |
hey guys i'm new to c and still learning.need some help here. i wrote this code and it isn't work properly,unable to figure out whats wrong!!but when the [B]strget()[/B] call from the main() its working.please some help... [CODE]main() { int x; printf("enter a value :"); scanf("%d",&x); switch(x) { case 1: … | |
* * * * * * * * * anybody can u write this program? | |
Hi, How to implement a stack using two queues ? Help pls! Regards, Preethi | |
[code]#include<stdio.h> #include<stdlib.h> #include<string.h> struct name { int *a; char b[10]; char c; }; int main() { struct name *p; p = ( struct name * ) malloc ( 3 * sizeof ( struct name ) ); char *n; n = ( char * ) p; *n = 275; strcpy ( … | |
Hello I would like to count how many words are in a string ie "PETER JOHNSON LTD" so this string contains 3 I was going to use strtok but this is too slow. Any other ideas? | |
Good day to you guys! im having a bit of a problem using strtok. im currently tinkering with extracting gps data, which are separated by commas. ive seen code in several forums but most of them assign the output of strtok to the same char pointer. what i want to … | |
Hey guys. So I basically read in a bunch of data from a file into a data structure. But while I was doing that I included the spaces (which I dont want). So now I want to compare each element to see if it does have a blank space, and … | |
I wonder why the following code work. In the debugger i see that every thing works fine but after the "root = createNode(item);" statement I can't see the new node assigned to root? [CODE]Node *insert( Node *root, int item ) { if(root==NULL) root = createNode(item); if(root->data>item) insert(root->left,item); else if(root->data<item) insert(root->right,item); … | |
i have this assignment due tommorow ive tryed it but it seems tuffer than what it should. anyone have any ideas? Write a function stage 1() that reads one of Tommy’s data files into a suitably declared and named data structure. You should assume that there will be at most … | |
need help- create a tree(simple m-ary),with each node having 4 dataitems & 5 children. "IN C-language" just 1 example showing 1 or 2 node created will be really helpfull(as this is tedious)........i have all operation clear till binary tree...but this 1 is not clicking!!!!..... or in case u knw any … | |
I posted this thread but it got transferred to another, can someone edit the code for me so that I can get the answer in exponentiation, (^)and(*), Example : Enter number : 8 Prime factors of '8' : 2^3 Enter number : 56 Prime factors of '56' : 2^3*7 [B][U] … | |
My program is a very simple address book program. The program works but i don't know how to make it display the same names. Like for example, the name "Mark Lee", if there are more than one Mark Lee, i would like to display all of those Mark Lee w/ … | |
In answer to a coworker's question today about memory management today, I wrote the following code. It's an implementation of the gets function that accepts an infinite length string (bounded only by the heap) and [i]does not[/i] force the caller to free the resulting pointer. I figure that it's a … | |
i have a problem when i use: [code] do { printf("press only A to continue):\n"); x=getchar(); }while(x!='A'); [/code] if i press anything the program prints me the message multiple times | |
Hi all, I am using the following function which I found online to trim the leading and trailing whitespaces from a passed in string. It works fine for all the cases but I am having trouble in understanding the process being a newbie to C world. [CODE]char *trim (char *str) … | |
hello frns.. :icon_smile: i am in need of a code that does the following very very urgently.. please please help me !!! [CODE]read strings from a text file "text1.txt" (which are stored 1 per line without spaces) and store these strings in a string array A[]. then read strings from … | |
How can i make sscanf() skip all whitespace characters?I read from a file and i dont know where are the characters. eg.->@Solomon Islands ,i need "Solomon Islands" in one string e.g->AGAF (AFT) – Afutara Airport – Afutara ,i need "Afutara Airport" in one string. | |
I want to know how to read from a file. I have posted the first line of program.dat file before. There are more than one line in the file and i want to tokenize them and save them into different variables or pointers. Can anyone write full code how to … | |
can anyone help me for a simple polynomial addition using list.. no matter how long it is .. but it must be simple ... | |
I would like to read a text file and store to strings some data that are important for me.I tried to do with strtok but wasnt successful?Can u help pls? [QUOTE]txtExample @Greece ASAS (FFF) - BLALAL BALLA BLALALAL - JAJAJAJAJ, XAKALXKAL ZMAH (AVK) – Arvaikheer Airport – Arvaikheer, Ovorkhangai ZMBH … | |
Is there a systematic method to analyze the time complexity of a program strictly from output data such as run-time, the number of data swaps, data comparisons, etc? For example... [icode] Data Size | Run Time | Comparisons | Moves --------------------------------------------- 1000 | 0.00 | 15448 | 23965 10000 | … | |
hi i am doing code on single linked list in that i hav to save elements of my list to a file and then load it. The file is not loading pls check this code [CODE]#include<stdio.h> #include<stdlib.h> struct llist { int info; struct llist *next; }; typedef struct llist linked_list; … |
The End.