#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void changeString(char *str);
int main(){
char *string;
string = (char *)malloc(5 * sizeof(char));
...
Type: Posts; User: giorgosmarga
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void changeString(char *str);
int main(){
char *string;
string = (char *)malloc(5 * sizeof(char));
...
I am supposed to use read and write system calls
Hey,
Is it even possible to write to a binary file a number as an int and not as a string? If yes how do i write it and how to i read it?
>There is a need to cast malloc in C since the exercise says so.
>How should i make tableRgs be the pointer I get from malloc.
typedef struct
{
long unsigned int code;
fullName name;
short unsigned int matches;
} registers;
typedef struct{
registers **rgs;
After realloc i am checking if the pointer if null, if it is it returns. Thats why i am kinda confused, my program crashes instead of returning.
Hey,
My programs crashes after the 27th time i call realloc. Is there a limit in realloc or what else could it be?
And if i do this:
registers rg;
matches mtchs;
rg.codeName = 123;
rg.matchCode = 123;
strcpy(rg.name->fullName, "123");
strcpy(rg.name->lastName = "123");
I am kinda confused with this.
typedef struct{
char firstName[SIZE];
char lastName[SIZE];
} fullName;
Hello,
How can i break a for/while loop when the user enters a specific string?
In the main function, I ask the user to enter 10 strings and the programm should stop when the user enters for...
Hey,
I have a function that returns an array that contains all the digits of a number
int seperation(int number){
int arrayOfDigits[SIZE];
int i = SIZE - 1;
int lastDigit;
...
Lets say i want to create a programm that takes a string and prints it
At the beggining i have to declare my string and give it a size.For example, if i give it 10, can i write this?...
Hello guys,
I want to create a struct that lets say is the employee and contains some values for the employee
If i want to create n employees(The user says how many are the employees of the...
int main()
{
int lastDigit;
char num1[3] = "123";
lastDigit = strlen(num1) - 1;
printf("%c", num1[lastDigit]);
return 0;
}
Guys, any idea why this code doesnt work?