Search Result

Collapse
15 results in 0.0028 seconds.
Keywords
Members
Tags
c programming
  •  

  • randomstring
    started a topic Strings in C
    in C

    Strings in C

    Hello. I'm new to C, and trying to figure out why some code I wrote isn't working. The code is supposed to receive a telephone number that could be formatted with digits, parenths, or dashes. It is supposed to strip out the parenths and dashes, retaining just the digits. Here's the code:

    Code:
    char* formatNum (char* validNum) {
        
        int counter;
        int index;
        int length;
        char* numOut;
    ...
    See more | Go to post
    Last edited by randomstring; Mar 13 '12, 09:22 AM. Reason: Added tag for C programming

  • karan173
    started a topic k&r chapter-1 question, creating a syntax checker
    in C

    k&r chapter-1 question, creating a syntax checker

    hey it is required to create a syntax checker which reports about common errors like unbalanced paranthesis etc. i hav created d following code, which complies finely and produces correct output for generally, but when i enter d source code as input, it produces wrong input, so csn u help me find d bugs:-
    Code:
    #include<stdio.h>
    #define IN 1
    #define OUT 0
    int main()
    {
        int c=0,prevc=0,prevprevc=0,sstate=OUT,dstate=OUT,cstate=OUT,count[256],boo=OUT,i=0,asciieq=0,line=0;
    ...
    See more | Go to post
    Last edited by Stewart Ross; Dec 30 '11, 02:31 PM. Reason: Corrected code tags - from <code> to [code]

  • NewProgrammer1
    started a topic Assigning a value to an array
    in C

    Assigning a value to an array

    i need to assign a value to an array but it is not in the normal way, here is the code so far:
    Department[1] = "Accounts";
    Department[2] = "Teller";
    Department[3] = "Loans";
    Department[4] = "Operations ";
    Department[5] = "Personnel" ;
    See more | Go to post

  • Jackson Paul
    started a topic Why is not a=0 in the following code..?
    in C

    Why is not a=0 in the following code..?

    Code:
    #include <stdio.h>
    int main( )
    {
    float a=1.0;
    long i;
    for(i=0; i<100; i++)
    {
    a = a - 0.01;
    }
    printf("%e\n",a);
    }
    See more | Go to post
    Last edited by Meetee; Apr 28 '11, 10:00 AM. Reason: Please add code tags [CODE]...[/CODE] around your code

  • Jackson Paul
    started a topic errors with malloc,arguments,memory leak
    in C

    errors with malloc,arguments,memory leak

    Code:
    #define LOOPS 100
    #define RAYSIZE 1024
    
    int main (int argc, char **argv)
    {
    int count = 0;
    char *pointer = NULL;
    
    for(count=0; count<LOOPS; count++) {
    pointer = (char *)malloc(sizeof(char) * RAYSIZE);
    }
    free(pointer);
    return count;
    }
    See more | Go to post
    Last edited by Meetee; Apr 11 '11, 09:27 AM. Reason: code tags added

  • C programming question Word Count for all files in a directory

    Hello. I am new to C programming. I needed help with a C program that is fairly simple but I am stuck since I am new to C programming.

    It involves using fopen() to iterate through all files in that directory, and get the word count. It also involves multithreaded programming.

    I have to process an x number of files for the word count in threads. For example, I have to use 5 threads to process 100 files. Meaning 20...
    See more | Go to post
    Last edited by Meetee; Apr 7 '11, 05:22 AM. Reason: Email id deleted

  • Prisms
    started a topic How to read a text file into an array
    in C

    How to read a text file into an array

    I am trying to read a text file into an array and I'm having some trouble doing so. here is the code that I have so far. Any help would be much appreciated.

    Code:
    #include <stdio.h>
    #include <ctype.h>
    #define MAX_ROW 15
    #define MAX_COL 6
    
    
    int main()
    {
    	FILE* numbers;
    	int x;
    	int ary[MAX_ROW][MAX_COL];
    	
    	
    	numbers = fopen("extradata.txt",
    ...
    See more | Go to post

  • Could somebody help me find the cause of a Segmentation Fault error in my program?

    The program compiles and works all the way until the multiplecheck function, any help would be great. The program is not finished yet and I am new to C programming so I know the program may not be the most efficient.
    Code:
    #include<stdio.h>
    #include<math.h>
    #define ARRAYSIZE 30
    
    int getData(int[]);
    void printData(int[],int);
    int multipleCheck(int[],int);
    int multipleCount(int[],int,int,int);
    ...
    See more | Go to post

  • atwinix
    started a topic 1 K or 1 G Array
    in C

    1 K or 1 G Array

    Hello!

    I am running some tests and I need to create arrays of specific sizes. I have scavenged many online tutorials/materials to try to find out how I can generate a 1-kilobyte or a 1-gigabyte array in C (or python) without much success.

    Could anyone please help?

    Gratefully yours,

    atwinix
    See more | Go to post

  • ocli5568
    started a topic fgets function problem
    in C

    fgets function problem

    What i've written below is a much simplified version of my program but it has the exact same problem (didn't want to bore people with long code).
    I wrote the printf's appropriate to what the code does or doesn't do.
    it doesn't take the fgets (in the function) in the second while loop but never the first, and i want it to take a string in the first.

    #include <stdio.h>
    #include <stdlib.h>
    #include...
    See more | Go to post

  • ocli5568
    started a topic C programming if statements
    in C

    C programming if statements

    I've read countless times, and in fact used it correctly, that you can use boolean logic in an if statement to test whether a string is equal to another string, although my compiler (visual studio 2005) just skips over this particular if statement.
    this is a snippet of the code:

    printf("Encrypt : file encryption program. Type h for help.");
    do
    {
    printf("\n>> ");
    fgets(init,...
    See more | Go to post

  • praveenaj
    started a topic Adding student marks to a Linked List
    in C

    Adding student marks to a Linked List

    I was given to write a C program using Linked list to enter student marks, but i can't figure out how this node insertion works:
    how nodes are linked with each other???


    A Computer Training Institute wants to store marks of the Theory and Practical Papers of Data Structures & Algorithm. This system keeps the Registration Number and the Name other than the two marks, and all the records should be inserted in increasing...
    See more | Go to post

  • Data structure for storing serial port data in firmware

    Hi all,

    I am sending data from a linux application through serial port to an embedded device.

    In the current implementation a byte circular buffer is used in the firmware. (Nothing but an array with a read and write pointer)
    As the bytes come in, it is written to the circular bufffer.

    Now the PC application appears to be sending the data too fast for the firmware to handle. Bytes are missed resulting...
    See more | Go to post

  • james457
    started a topic Linux Wireless Network Testbed
    in C

    Linux Wireless Network Testbed

    Hi all,

    I am writing a linux testbed for wireless sensor networks. The core objective is to test data transfer between any two nodes. The network runs using tree topology.
    One node in the network is the "Driver". This node is connected using serial port to a linux PC. What I am trying to write is the software on this linux PC that will drive data transfer in the network.

    The "Driver" node,...
    See more | Go to post

  • crystal2005
    started a topic Translating alphabetic number in C
    in C

    Translating alphabetic number in C

    Hi guys,

    Just like the title, i'm looking for the example of C program that translates an alphabetic phone number into numeric. The idea as the following output

    Enter phone number: 1800-TEST-100

    result: 1800-8378-100


    so basically 2=ABC, 3=DEF, 4=GHI, . . . , 9 = WXYZ

    So, all the non-alphabetic (E.g. dash, punctuations) will leave unchanged.

    Can anyone give the...
    See more | Go to post
Working...