I managed to solve the issue. I was using fixed sizes for region and country and I think they were to small. I replaced them with dynamically allocated arrays and it's working
Type: Posts; User: rmmstn
I managed to solve the issue. I was using fixed sizes for region and country and I think they were to small. I replaced them with dynamically allocated arrays and it's working
I have a CSV file of the following format:
Region, Country, Item Type, Sales Channel, Order Priority, Order Date, Order ID, Ship Date, Units, Sold, Unit Price, Unit Cost, Total Revenue, Total Cost,...
#include <stdio.h>
#include <stdbool.h>
#define M 5
#define N 5
// 2 - free spot ; -1 - vertical line ; -2 - horizontal line ; 1 - X ; 0 - 0
You're right, my lcp() function was the issue, it's working perfectly now, thanks a lot!
I've tried doing
char *result = NULL;
result = (char *)malloc(sizeof(char) * 100);
But I'm still facing the same issue when debugging :/
Yes this works, but does this till use divide and conquer? I'm just learning this method and I can't always recognize it
I'm trying to write a program that prints the longest common prefix, using divide and conquer, but I'm getting a seg fault and I'm not certain why. I'm guessing it has something to do with the result...
I've updated the code:
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define MAX 1000
#define HEIGHT 24
I'm trying to solve a maze from 'S' to 'E', then printing the solution with a '.' in each cell from the path. The maze is:
...
So, I know the question sounds strange but I don't really know how to phrase it better. I'll try to explain: I'm writing my own version of printf, this is the code I have so far:
#include...
I'm trying to sort data from a .csv file based on the year (3rd field), using qsort and bubble sort to test the speed of both:
Look What The Cat Dragged In,Poison,2001,Look What The Cat Dragged...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 3000
typedef struct{
char name[100];
I want to write a simple version of tar, that is able to archive files provided as command line arguments (no compression needed). I've just started learning about binary files so I'm a bit lost.
...
Nevermind, I didn't see he defined each function after main :/
I see, I've never encountered them before, that's why
Could you please explain this part? I don't usually use global variables, why did we declare them globally and not in main. Also, would it be possible to use a struct until entry, then use another...
I want to print the file, program and section headers from an ELF file, but I'm getting some weird results.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef struct{
#include <stdio.h>
int main()
{
int i = 0;
for(i = 0; i <= 10; i++)
{
float offset = (i/1000)*256;
printf("%d\n", (int)(offset));
So should I initialize with strlen(word)+1 * sizeof(char)?
I need to parse data from a csv file but for some reason I'm getting a segmentation fault error. I have exactly 5 comma separated fields on each line so I wanted to use an array of pointers to hold...
Okay, so if I declare c as an int could implement the same logic and just typecast c to char?
I want to count the number of occurrences of each character found in the input and print it to the output.
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
...
I want to make a menu that classifies animals into insects, birds, mammals and fishes with specific characteristics for each of these (using composite variables). I thought I'd use a nested switch...
I have the following .txt file:
1 7 9 12
8 4 22 5
4 9 0 10
15 2 3 14
I wanna print the lines in descending order based on the average value on each individual line.
...
Thank you! If I wanna work with dynamically allocated arrays is this the way to go?
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define MAX 100
unsigned...