Questions tagged as 'c'

3
answers

What is the difference between char name [] and char * name in C?

Someone can explain to me what is the difference between: char* name = "Gerardo"; or char name[] = "Gerardo"; I would like to know the differences in terms of memory or performance.     
asked by 09.09.2016 / 19:14
2
answers

Pointers as parameters to functions in c

Hello people, I have a small problem. I am creating a function that receives as parameters a double pointer. This function receives the parameter and assigns it dynamic memory. Once the memory is assigned, I call another function that assigns va...
asked by 03.04.2017 / 03:00
3
answers

How does the range of a specific type of data affect in C language?

Most videos in C show a table with the type of data, its size and range. In the case of INT the value is between -32768 a 32767 . I would like to know what this affects, since I put a value like this 33000 and it...
asked by 31.03.2017 / 21:12
3
answers

Open compiled program in terminal

Hello, I have a console program in C, it compiles well in Ubuntu, but when I open it, it does not generate the console window, I have to open it from the console in order to achieve this. What should I do to have the program open automaticall...
asked by 28.02.2017 / 17:06
2
answers

"Trash" values in arrays?

I've been practicing how to use vectors in c, and I've run into several simple programs that I've done with "junk" values, for example in the following code that consists of the user typing their full name, including spaces: int main() { int...
asked by 09.08.2017 / 20:36
3
answers

Difference between declaration of structs

1st code: #include <stdio.h> #include <string.h> #include <stdlib.h> struct{ int edad; char *ptr; }hola; int main(){ hola.edad=2; printf("%d\n",hola.edad); hola.ptr=malloc(5); strcpy(hola.ptr,"Hola"...
asked by 11.05.2018 / 13:30
1
answer

Character strings as pointers in c

I am learning C and I understand perfectly the pointers and their relation with the arrays, but my problem comes with the character strings. We declare a string of characters like this: char cadena[] = "Hola"; is equivalent to: char caden...
asked by 25.08.2016 / 20:43
3
answers

Compare content of two strings in c?

Hi, I'm new (new programming too) and this is my first question, I would like to know how to compare two chains. This is what I did but it turns out that it does not compare me but throws me the second message no more. char pal1[10],pal2[10];...
asked by 30.09.2017 / 01:47
1
answer

Read binary file in C and pass it through JNI to java

Hello, the program that I have works but I know how it is that C can read binary files, supposedly I know that with rb it is reading binary files but in the part of C, a < strong> NewStringUTF , which makes that when you read some special char...
asked by 26.10.2016 / 19:02
2
answers

For N nested loops in C

Good morning, I'm starting very little in C, trying to learn well from the base. I've been thinking about a simple script for too long, since I do not quite understand why its output, which is the following: * ** *** **** ***** The scrip...
asked by 28.09.2016 / 11:58