15,539 Topics
| |
[code]#include <stdio.h> char *matriz; char n; int cuad; void guardarValor(lin, col, valor) { int pos = ((lin-1)*n) + (col-1); matriz[pos] = valor; } void imprimeMatriz() { int cont; for(cont=1;cont<=cuad;cont++) { printf("%d\t",matriz[cont-1]); if ( cont%n == 0 ) printf("\n"); } } int main() { int cont, posL, posC; n = 5; … | |
I posted a couple of days ago about this subject but I have a more specific question about programming with music in c. My main question is that are the ID3v1/ID3v2 tags universal for ALL music files or are there a specific tags I should be checking for, for a … | |
Hello, could someone help me create a program that will take in separate strings from a user and then output it all on one line in random order? This is what i have so far: [CODE] #include <stdio.h> #include <string.h> #include <stdlib.h> int compareStrings(const void *pStr1, const void *pStr2) { … | |
Hey i got the same error in my code and as discussed i cant rectify it after changing the u value. The error is on a linux machine. The program checks if a no is prime or not. [CODE] #include<stdio.h> int primality(int n) { int i; char ch='y'; for(i=2;i<n;i++) { … | |
Hi all, I'm pretty new to C, so apologies in advance, I am trying to write code that will allow me to input a line no and then display the text from that line from the corresponding file. I'm having a bit of a brain fart & can't work it … | |
Hey all this code should read in info and store it to a file. Then retrieve the file and calculate the sum and average of the row and column. But for reason I keep getting rubbish for my sum and average output. can someone look at it and tell what … | |
hello everyone, i need to modify these code: [code=c]#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int numOfStars = 0; int count, counter; do { printf("N="); scanf ("%d",&numOfStars); for( ; counter<=numOfStars; counter++) { for( ;numOfStars>0; numOfStars--) { if (numOfStars != 9999) { for (count = 0;count < numOfStars; … | |
Hi I've saw the following piece of code (it doesn't work in this form why?:-O): [CODE] #define CPU AMD #if (CPU == INTEL ) printf("Intel\n"); #elif (CPU == AMD ) printf("AMD\n"); #else printf("CPU isn't defined\n"); #endif [/CODE] Note I tried this on M$ complier & GNU gcc works the same | |
Hi Guys (and gals), Thanks for taking the time to read this, hope someone can help. I've been tasked with developing an anti-virus scanner as part of a university assignment. I've written all the signature matching code, which works fine, and the software can scan through a directory and find … | |
Hello when Im trying to learn strncpy function, I copied a part of string to another char array, but it gave me different results when I used puts and printf functions. Can anyone tell me why such difference occurs? I guess its about the last terminating NULL character, but Im … | |
I am trying to write a program in C with a main function and five other functions: input, output, calculate day of year for a calendar date, calculate calendar date from day of year and year, and determine if its a leap year function. I have a problem with calendar … | |
| Hi, I am attempting to create a dynamic array using realloc in 2 dimensions. Currently i have managed to get it to work using realloc to dynamically resize the amount of rows but when I attempt to use realloc to dynamically resize the amount of columns per row I keep … |
how would i be able to open and read a .obj file(for a 3D model)? i need to extract the vertexes and their normals | |
| I am writing a code to open a command line, prompt for the name of a file to copy, prompt for a new file name, then it should copy the file (adding a header and line numbers plus adding .lis to the filename of the new file). I BELIEVE I … |
how would i be able to seperate the text inside a file into the lines they are in? eg: [code] char *lines; lines = seperate_into_lines(a_file); /* not a function */ [/code] | |
Hey guys and gals, I just wrapped up my first year of University CS and I feel like tackling my first personal project. My program will need to read in the mp3 title, artist, and album of many mp3 tags. My problem is that in class I only dealt with … | |
he below code works fine with dec c++ compiler but when run on visual studio gives the error at fseek[code]#include<stdlib.h> #include<stdio.h> #include<conio.h> int main() { FILE *fp; char *stringBuff; int i; int epi = 0; long lSize; fopen_s (&fp, "sequence.txt" , "rb" ); fseek (fp ,0 , SEEK_SET); lSize = … | |
I've come across two questions from my previous years college test papers. I just couldn't solve them [LIST=1] [*][I]Define rational number as an ADT (abstract data structure)[/I] [*][I]Write a suitable C code to sort a finite set of elements where an element may appear a large number of times[/I] [/LIST] … | |
Hey, I am new here. I just started coding in C a couple of weeks ago. I am trying to create a simple program to input data into an array using a text file with 10 records. However, the array length is 16 and a couple of records in the … | |
hey plz can anyone do this for me Task-1: 1. Write a C code that takes a file as input. Say input.txt which has the information about the object to be transformed, type of transformation, etc. 2. Input file can have following different formats. Case 1: P # first line … | |
hay!!! please can Write a program that accepts as input a date in the form, MM-DD-YYYY, where MM represents the month of the year, DD represents the day within the month and YYYY represents the century and year. After input of the date, display the date in textual format and … | |
Hey guys, i'm having trouble with having to simulate a user entered number of parties and user entered number of guests. I am supposed to have a function with the prototype int party(int n) that will simulate one group at a time with n guests. I have to assign each … | |
Hi, I just started taking a programming class and am having trouble figuring out why this wont program wont work correctly. The user inputs their coordinates and the program returns whether it is in quadrants 1,2,3,4 or on an axis or the origin. [code=c]#include <stdio.h> int main(void) { double xcoord, … | |
hello everyone, I wrote some code on binary search in algorithms using c but here is my problem: [CODE] #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <time.h> #include <ctype.h> /* TASK: Demo about static, linear data handling. Four basic operations are exercised: 1) find 2) insert … | |
| I got this code from a book and it doesn't seem to work. I've triple checked for common mistakes and syntax errors but can't find any. Please tell me where I am going wrong. #include <pthread.h> #include <stdio.h> #define NUM_THREADS 5 int main(int argc, char *argv[]){ int i, scope; pthread_t … |
Maybe you could help me with the following code... [CODE=c] int main() { char foo = '?'; // foo is created on the stack. char* bar = "Hello World"; // where is bar created? // will the following result as a NOP or undefined behavior? free(bar); return 0; } [/CODE] … | |
help me how to download turbo c , and how to open . and how to start. | |
After a lot of trial & errors, I've managed to create an array as follow : xxx xxx xxx xxx 000 000 xxx 000 000 x00 000 000 x00 000 000 x00 000 000 x00 000 000 x00 000 000 x00 000 000 Now, when a user enters a value … | |
[CODE] typedef struct grid Grid; struct grid{ char grid[MAX_ROW][MAX_COL]; } void storeGrid(Grid *store_grid,int row, int col){ Grid *store_grid; store_grid = (Grid)malloc(sizeof(Grid)); //Grid storeGrid; //int grid[MAX_ROW][MAX_COL]; int rowNum, colNum; for(rowNum = 0; rowNum <= row; rowNum++){ for(colNum = 0;colNum < col; colNum++){ store_grid->grid[rowNum - 1][colNum] = 'a'; } } // Calls … | |
sir i want to lock with password protection to my '.c' files.how i can do that. please suggest sir. thanks |
The End.