15,551 Topics

Member Avatar for
Member Avatar for ninja_girl

Hello, I'm a C newbie (first time using C at university) and after reading a few books, I still have problem implementing & understanding structures and pointers. I have the following structure: [CODE]typedef struct data { double average; }Tdata; Tdata stat = {0};[/CODE] Now I have two functions which are …

Member Avatar for Ancient Dragon
0
88
Member Avatar for shmeeps

I'm working on a project for school. Normally I'm a C++ guy, but I have to go through standard C before that, so I'm struggling with certain aspects being different, such as getline. Here's essentially what I'm doing, I have a data file that has a certain about of lines …

Member Avatar for shmeeps
0
171
Member Avatar for splurchner

This is a program I wrote for class, and its completely done and compiles with no errors, but I keep getting a segmentation fault and even after using GDB and putting print lines (with fflush attached) I cannot figure out what the problem is. I do however think I found …

Member Avatar for Dave Sinkula
0
186
Member Avatar for Ineedhelpplz

suppose I have: [CODE]#define special_for(X,Y) { register int i = 0; for (;i<X;i++) {Y} }[/CODE] It is used in the following functions: [CODE]init_lineholder(int nlines) { [COLOR="Red"]special_for(nlines, lineptr[i] = (char *)malloc(MAXLEN); tmp++;)[/COLOR] }[/CODE] AND print_lines() { [COLOR="red"]special_for(tmp, if (lineptr[(first+tmp-i)%tmp] == NULL) break;[/COLOR] else printf("%s\n", lineptr[(first+tmp-i)%tmp]) ; ) /* had to space …

Member Avatar for jonsca
0
88
Member Avatar for mo_91

Drawing Hello 1. Horizontal Hello 2. Diagonal Hello Enter choice: 1 * * ****** * * **** * * * * * * * ******* **** * * * * * * * * * * * * * ****** ****** ****** **** Drawing Hello 1. Horizontal Hello 2. Diagonal …

0
49
Member Avatar for kiel19
Member Avatar for domjdragon2
-2
132
Member Avatar for Ineedhelpplz

So I have an assignment that I have been attempting for 2 weeks now and the class has been given extensions twice now. Everyone seems to be struggling with this part of the assignment. The assignment is to do K&R Exercise 5-13, unix tail command. [COLOR="Red"] Instructions: "The program takes …

Member Avatar for Ineedhelpplz
0
243
Member Avatar for seo2005

Hi, This has been discussed ealier, but i would like to know how the loop executes 1. #include<stdio.h> 2. #include<conio.h> 3. void main() 4. { 5. int x,y,z; 6. scanf("%d",&x); 7. if(x>0) 8. { 9. y=x/10; 10 z=x%10; 11. x=y; 12. printf("%d",z); 13. } 14. printf("%d",x); 15. } Suppose I …

Member Avatar for pramodsajwan07
0
113
Member Avatar for shakunni

I need to edit every character of a string for an assignment; apply a simple Caesar cipher on it. What is the C equivalent of "charAt()"? I remember my prof saying that all strings are terminated with a certain character in C and that you could run a while loop …

Member Avatar for shakunni
0
78
Member Avatar for ankur_

I am starting to learn C basic OS Concepts and I have to code them using C. Can anyone suggest me some good links where I can get basics of the complete OS Concepts like (process,IPC,thread,sheduling,File management,Memory management, Security) I have got good idea about the concepts but I am …

Member Avatar for ankur_
0
133
Member Avatar for ArjunRaja

Hi I am new to C. I want use properties file in C like how we use in "java" and "Perl". I want to read the values from a file and have to use those values in another file. This logic is to avoid hardcoding username and password.

Member Avatar for ArjunRaja
0
109
Member Avatar for Whilliam

Hello, I've been having problems with my program. I really don't get files that much. This is my code: [code=c] #include<stdio.h> #include<string.h> #include<stdlib.h> #include<conio.h> #define max 3 typedef struct { char FName[24]; char LName[16]; char MI; }name; typedef struct { unsigned long ID; name n; char course[8]; int level; }profile; …

Member Avatar for super-sonic
0
138
Member Avatar for MeBjess

This is part of some class work I have to do, but this is not what I am turning in as my assignment! It does have some bugs, but as long as the user only enters an integer it runs fine. I have included just the part of the code …

Member Avatar for MeBjess
0
111
Member Avatar for shakunni

How do you add a character to an existing string? In java you could just do: char c='a'; String b="posit"; b+=c; but I tried doing that in C and it doesnt work. Is there a workaround? Thanks.

Member Avatar for shakunni
0
88
Member Avatar for shakunni

I need to read data from a flat file [find below] into a linked list. Each line is a record and each record needs to be read into a different node. After I open the file using fopen(), I have the following problem: 1) How do I move from the …

Member Avatar for gerard4143
0
103
Member Avatar for shakunni

Hey, How do I create a file from a C program? I want to check if the file exists and if it doesnt, then create it. I am using the following code to check if it exists: [code] filecheck() { b=fopen("password.csv","r+w"); if(b==NULL) { // need code for creating a file …

Member Avatar for venomxxl
0
116
Member Avatar for tag234

Hello, I am currently trying to write a program that will read from either stdin from a file (using <) or from piped input. I have the portion using the < working because i am able to read the st_size of the file and create a read() call accordingly: read(0,&inptr,stdinfo.st_size); …

Member Avatar for banders7
0
188
Member Avatar for Sarang07
Member Avatar for idiotninjaz

Okayy, So. I'm required to make a new set of functions for the <string.h> library and am confused on a few things, and am wondering if anyone can help me out. I'll toss out the ones I'm struggling with. int mystrcmp(const char* s1, const char* s2); This function will compare …

0
87
Member Avatar for Iam3R

i have just written a small program on DEV C++. i have been using it for couple of months but i never observed this error. [CODE] #include<stdio.h> int main() { printf("Welcome\n"); system("PAUSE"): return 0; } [/CODE] could not create makefile I/o error 32 any idea? what does that mean

Member Avatar for Iam3R
0
93
Member Avatar for wangatang126

Hi i have a binary function search program where the user enters a index of numbers, then enters the number he wants to find. However my program wont compile and says the subscripted value is neither an array or pointer. Help me out please. Here is what ive got: [CODE]# …

Member Avatar for stephen186
0
101
Member Avatar for imolorhe

I was just wandering about the user interface of C applications. What are the basic things one should know about programming a graphical user interface with C.

Member Avatar for jbennet
1
101
Member Avatar for cutedipti

A hospital keeps a file of blood donors in which each record has the following information (i) Name (ii) Age (iii) Address (iv) Contact no. (v) Blood group. I have to write a program to enter record into a data file “blood donors.dat” and display information of each donors. And …

Member Avatar for Gaiety
0
95
Member Avatar for *nix

i am new to unix. i have written a code for testing the basic functions read / write and open i have read that read/write returns the no of bytes read/written but here my write is returning 1 and read is returning 0 no matter how many chars i write. …

0
47
Member Avatar for arsh_arsh

need to replace all occurences if substring by new string. below code replace first occurence but not other substrings present in input string.

0
250
Member Avatar for smithu.simi

Does anyone out here have an idea as to how to go bout simulating a DFA (deterministic finite automata) in C which accepts multiples of 3 ?????

Member Avatar for thines01
0
75
Member Avatar for raigs

I get this gcc warning with [I]-Wwrite-strings[/I] flag. I want to return a string of chars correctly but I also do not want to use [I]malloc[/I]. I've read other posts but can somebody explain how to acheive this in layman wording? [QUOTE]a.c:14: warning: passing argument 1 of ‘VAR1’ discards qualifiers …

Member Avatar for Dave Sinkula
0
389
Member Avatar for tjackson

I am new to c programming. I am trying to write a parking garage program that uses arrays to find the charge for each car and the total charge. Here is what I have so far. Please help me in any way that you can. [code=c]#include <stdio.h> #include <math.h> float …

Member Avatar for Chilton
0
142
Member Avatar for Aamit

[code=c] #include <stdio.h> #include <conio.h> int main(void) { unsigned port = 0; int value; value = outp(port, 'C'); printf("Value %c sent to port number %d\n", value, port); return 0; } [/code] It gives error 8 C:\Dev-Cpp\Abc\... `outp' undeclared (first use this function) How to solve this ?? I write function …

Member Avatar for BobClark
0
568
Member Avatar for thebluestar

[CODE=C] #include<stdio.h> #include<conio.h> #include<string.h> //typedef int BOOL; //#define TRUE 1 //#define FALSE 0 int a[3][4]; int Prime(int *x); void input(); void printOut(); void checkPrime(); int Prime(int *x) { int i; for( i=2; i< (int)sqrt(*x); i++ ) { if( *x%i == 0 ) return 0; } return 1; } void input() …

Member Avatar for thebluestar
0
192

The End.