john.c, sorry. i guess it was too early in the morning for me to read carefully.
i just read it again and it makes sense now :D and also works and, so thanks!
but what i'd like to do is not to...
Type: Posts; User: lmanukyan
john.c, sorry. i guess it was too early in the morning for me to read carefully.
i just read it again and it makes sense now :D and also works and, so thanks!
but what i'd like to do is not to...
thanks for the suggestions.
it seems logical to me but this code doesn't even display one console. i tried to get an input from the function that creates/deletes the console but it won't even stop...
as the title suggests, i need to have 2 separate console windows in my application. one should be the "main" console, and the other should be an independent one that has its own inout and output...
With strtok I guess I could assign char*'s to array of ptrs, but I should define a whole list of delimiters so its not convenient. And no, everything is not space separated.
well, the user input is a math expression, so i wanna separate the numbers and the operations, like this:
char* a[] = {"566", "+", ...}
i need to extract numbers from user input. i think it's best to extract them into array of pointers because in that case i can refer to the numbers with their index.
i can't assign an int (which...
okay i did that. is this how it should look like?
14631
i tried to read these data from file with another code and it printed the correct account number and balance, as i inputted (and not...
just trying to run and understand this example from the book. the code compiles and runs correctly but i get weird results in the file. the account number i enter appears as a symbol in file, and the...
i generate a random number is in a function other than main, and the result of this function is sent to main. in which function(s) should i write srand(time(NULL))?
i made some changes and got this, it actually works but only after the second time i enter a valid number. i.e. i enter 0, it says "enter 0,1,2,3,4" then i enter 0 and only then it works, same for...
yeah i copied and forgot to change the name :D
and how do i limit the choice to be a number? i wrote this but it creates an infinite loop. where in code stop it?
while (choice < 0 ||...
#include <stdio.h>
#include <conio.h>
#define STUDENTS 4
#define EXAMS 5
void printArray(int [][EXAMS], int, int);
void minimum(int [][EXAMS], int, int);
In an online compiler the code worked.
I included <string.h> library, maybe I should add anything else?
P.S. strcat, strncat don't work either (print null as a result)
int main() { char x[] = "Happy Birthday to You";
char y[25];
char z[15];
printf( "%s%s\n%s%s\n",
"The string in array x is: ", x,
"The string in array y is: ",strcpy_s( y, x...
int main() {
const char *str="-1234567abc";
char *PTRremainder;
long x;
x = strtol(str, &PTRremainder, 0);
printf("The string \"%s\" to long is: long %ld and string is %s, x+3 is...
I just started learning pointers to functions, and I can't say I understand everything clearly, so a little help would be appreciated.
Can someone please explain me how to use an array of pointers to functions with some basic or middle level examples? How do I know when I should use it?
EDIT: also pointers to functions.
Like thiS?
void someFunction(int *ptArr, int *(ptArr + SIZE-1)); // assuming SIZE has been defined
And how do i.pass this pointer to thr end of the array to the function???
1 /* Fig. 7.15: fig07_15.c2 This program puts values into an array, sorts the values into
3 ascending order, and prints the resulting array. */
4 #include <stdio.h>
5 #define SIZE 10
67
void...
Well, I wrote this:
int main() {
int a[10];
int *pt1 = a; // a pointer to the beginning of the array, i.e. a[0]
int *pt2 = &a[9]; // a pointer to the end of the array, i.e....
I'm a little bit new to addresses and pointers. I'm trying to remember what I know but I can't really figure out why you mentioned the &. Well, if we know the type of the elements of array and the...
int a[10];
int *p = a;
p is the same as &a[0].
how to write a pointer that points to a[9] (i.e. the last item of the array)?
void printCharacters( const char *ptStr ){
for( ; *ptStr!='\0'; ++ptStr) {
printf("%c",*ptStr);
}
}
In this function ptStr points to a char, and char is 1byte, so ++ptStr means...
Hello guys. I have a question to those who have or had an experience of job in the field of programming in C/C++ or, in generally those who can help me. I'm learning C with Deitels' "C: How to...