15,552 Topics
| |
HI all ! I am looking for C source code for a simple control flow graph generator.This generator should take input as C,java files and make nodes for If-else,switch statements,for & while loops.I just need a output in text form no visualization required.Can anybody help Thanks | |
[CODE]#include<stdio.h> #include<string.h> int count(char string[]); void main(){ int i; char string[1001]; printf("String: \n"); gets(string); i = words(string); printf("No. of Words %d", i); } int count(char string[]) { int i, j, k; for(i = 0; i < strlen(string); i++){ if(string[i] == ' ') k += 1; else j += 1; } … | |
I have a while loop reading names from a file and placing them in an array. When I print the contents of the array, it prints the last name that went through the loop, so I'm assuming that as the loop is progressing each time the names are being rewritten. … | |
I wanna write a code which would add the digits before decimal and after decimal. eg:- 12.22 would add upto 3.4 , 491.941 would give 5.5 [CODE] #include<stdio.h> #include<conio.h> #include<string.h> void main() { double a1[5],a ; //array of 5 numbers int b,len,i,sum=0,cnt = 0; char ch[10]; for(i = 0;i<5;i++) // … | |
#include<stdio.h> #include<stdlib.h> void show(const double a[], unsigned elements); int main() { const unsigned elements=10; const double a[10]={0,1,2,3,4,5,6,7,8,9}; printf("\t\tArrays and Pointers\n\n"); show(a,elements); return 0; } //FUNCTION 1 void show(const double a[], unsigned elements) { unsigned x; printf("\nValues in Array are :\n"); printf("[%u]:",elements); for(x=0; x<elements; ++x) { printf("%d",a[x]); } printf("\n\n\n"); } Output: … | |
[CODE] #include<stdio.h> #include<conio.h> void main() { int num[50],i,i1,j,temp = 1,cnt = 0; printf("How many elements "); scanf("%d",&i); printf("Enter the elements "); for(j = 0;j<i;j++) { scanf("%d",&num[j]); } i1 = 0; j=1; while(i1 < i ) { for( ;j<i;j++) { if((num[j] < num[i1])&& (i1<i)) { temp = num[j]; //algorithm for sel … | |
Hi there, is it possible leave a scanf blank? For example my code is: [code=c]scanf("%s%s",&a,&b);[/code] After entering the string for "a", I would like to leave "b" blank so I press enter but it just jumps over to the next line, is there a way to leave a "b" blank? … | |
I'm supposed to create a program that reads in the name of a file, then takes the names of students, which are listed (last, first, m) and concatnate the first with the last (firstlast) and add .dat at the end for each student to open a file with and unknown … | |
good day guys. i was studying a particular block of code and came across an operator: ->. im not exactly sure what it does. i found some notes saying that ptr-> is equivalent to(*ptr). for the life of me i just cant see how that applies here. care to help? … | |
Hello. im having a little problem with file inclusion. im getting the following errors: error LNK2005: "long * addresses" (?addresses@@3PAJA) already defined in rere.obj fatal error LNK1169: one or more multiply defined symbols found My 3 files are as follows: mainFile.c [CODE]//Program for a singly-linked list #include "def.h" #include<stdio.h> #include<stdlib.h> … | |
hi! i'm a beginner in using turbo c can anyone help we with these problems? help will be very very very very very much appreciated C PROGRAM # 13: INCLUSIVE VALUES Write a program that asks the user for a starting value and an ending value and then writes all … | |
Okay so the object is to print a wheel based on the user's input of the inner and outer radii. I've written a program that checks to see if the distance of the x and y is within the radius. However, i get some weird stretched out tire. If anyone … | |
Can any one help me to optimize this code. Or possible to alter and make it more simple The out put i need to get is [CODE] 1 212 32123 ....... [/CODE] this is the code [CODE] main() { int i,j,k,n=4,val,flag=0; for(i=0;i<n;i++) { for(j=1;j<n-i;j++) putchar(' '); val=i+1; flag=0; for(k=0;k<2*i+1;k++) { … | |
Hi all, I'm making a client server program in Linux. I use fork() to create a child process of the server to handle a new client. When a client disconnects it should kill the child process. At the moment the program is able to kill the fist client(server) that connects, … | |
I'm in a rough situation, i'm currently re-reading all of my textbooks to assist me with this work, however I am really in a rough spot being time limited I really want to get somewhere from what I have (and fix what I have). What I need to correct/add. -I … | |
pls tell what is the difference between this two 1)taking a initger (or any fundamental data type) pointer in the main function and then send it to some funtion as parameter. int *p; function(p); 2)taking a intiger and sending its adress to any function. int p; function(&p); will both do … | |
I'm trying to write a matrix multiplication program that takes in an int N on command line, creates two NxN matrices A & B, randomly populates them with ints, and then computes the result of multiplying A and B. I wanted to avoid malloc, but the first version started segfaulting … | |
Can some one please recommend me a link or the code for converting binary to decimal, hexadecimal and octal. Another for converting octal to binary, decimal and hexadecimal. Thank you and please help. I really do need it. Again, thank you and have a nice day! :) | |
I can't get strcmp() to return 0 with the following code. please help.. [CODE] char quit[10] = "q"; scanf(buf, ""); fgets (buf, 100,stdin); fflush(stdin); if(strcmp(quit, buf) == 0) { printf("Quiting program\n"); ...[/CODE] when I type 'q' into the command line it should enter that if statement, but it doesn't. | |
how to create a password program in c++ .. please give me some code .. thanks | |
Hello everyone...!! I want to know what exactly is the concept of Abstract Data Types and how is it related to data structures...? I tried some standard books on this topic but found them too complicated for me to understand Thank you | |
Hey everybody, I saw the thread for this in c++ but I want to know this for c language. I want to write a program in c that lets me calculate the heap memory size available to malloc function as well as the amount of size currently allocated. Can anyone … | |
Can anyone please explain why a self reference on a structure is allowed, but not a variable of that type? This is what i mean: [CODE] struct node{ int a; struct node *n1; }; /* This is allowed */[/CODE] [CODE]struct node { int a; struct node n1; }; /* But … | |
Any suggestions on the best online tutorial/ebook/printed book regarding C libraries and latest c std? I would like to get more coverage on FILE I/O s Thanks in advance | |
i am trying to do a program that reads in an arbitrary number of lists of integers. SPECIFICS -A valid list of integers consists of AT MOST (could be less than) 20 integers. -You can be given less than 20 numbers. -You might be given more than 20 numbers. This … | |
[CODE] #include<stdio.h> int main() { FILE *point; char others[35]; int indexer,count; strcpy(others,"Additional lines."); point = fopen("tenlines.txt","a"); /* open for appending */ for (count = 1;count <= 10;count++) { for (indexer = 0;others[indexer];indexer++) { putc(others[indexer],point); /* output a single character */ putc('\n',point); /* output a linefeed */ } } fclose(point); getchar(); … | |
| |
This is for an assignment. The child process never prints it's output, or calls the fibonacci functions. I've got other sample programs where the printf command works. Any help would be appreciated. Thanks in advance. [CODE] #include <stdio.h> #include <stdlib.h> #include <sys/wait.h> #include <errno.h> #include <unistd.h> #define MAX_SEQUENCE 10 typedef … | |
Hi , i have to merge two arrays that are already sorted in ascending order .Somehow my code doesn't give the correct output .Can someone please help [code=c] include<stdio.h> #include<conio.h> void merge(int a[],int b[],int m,int n); int main(void) { int a[20],b[20]; int i,n,m; printf("\nEnter the number of elements in array … | |
hi a set top box is connected with the tv testing the source signal resolution is 720x480i and the tv resolution is 1280x720p... the signal resolution is converted to tv resolution and proper output should be displayed.This was the process Here we have to change different resolution for tv and … |
The End.