Ammar
why deleting line 17 incurs undefined behavior?
Sorry for replying old discussion, this mystery has been answered here:
https://stackoverflow.com/questions/65456297/linux-x86-64-fork-syscall-strange-behavior-against-c-standard-libc-file-i-o-key
Anonymous
send here
Is is more than 400 lines of code
ɴꙩᴍᴀᴅ
Eturnus
Can anyone help me to understand a simple c program please
I am unable to understand it
Junaid
Eturnus
#include<stdio.h>
int main()
{
int a ,b;
printf("Enter the two four digit numbers:");
scanf("%2d %4d ",&a,&b);
printf("the the two numbers are : %d and %d",a,b);
return 0;
}
Output
Enter the two four digit numbers:2345 5685
the the two numbers are : 23 and 45
[Process completed - press Enter]
Eturnus
This one
Eturnus
Tangent Alpha
Tangent Alpha
Anonymous
what's the code for?
It shuffles a card deck using stack data structure and then buys 5 cards. It uses the random function.
Anonymous
How can be read a txt file by using linked list queue from it?
Tangent Alpha
Nils
std::shared_ptr<User> new_user = std::make_shared<User(data)>;
Why doesn't that work? (No viable conversion)
Igor🇺🇦
Ausir
Hi @JRandomGuy just to say I figured out how fork works, I was using it in the wrong way! Now I studied better fork and execvp syscall and now I can use them! Thank you a lot for the tips and the patience you had with me 🙏🏻
Happy New year to you and to you all guys!
Prometheus
Anyone have any suggestions on transferring an object from one vector to another? My thought was just to push back the object from the first vector onto the second one then remove it from the first. I found something referring to a move function in a google search but wasn’t sure what would be the most efficient/easiest to implement if it had to be done multiple times.
Alex
Nils
Alex
Ahadu
Hey gays
I am Epheson
I chatted from Ethiopia and i learn c++ programming.
And i am just happy for join this group
Alex
Shaswat
Anyone can send data structures and algorithms note pdf pls??
Prometheus
this is moving
Yes, in the end they do move it and serve the same purpose lol. This doesn’t seem like it’s going to go anywhere. Thanks for the reply, though.
tartaerae
Hello guys, i found the code in C, written on a if else using an array.
like this
[i + 1] [i + 2].
I was confused for [i + 1] is it(the plus 1) are a math operation or.. how?
Igor🇺🇦
Eturnus
int i = 10, j = 20, k = 0;
k = (++i) + (--i) + (j++);
Please explain ne how compiler showing k=40
My calculation:
K=(11)+(9)+(21)
K=41
Anonymous
Anonymous
Anonymous
Programmers
var runtil = /Until$/, rparentsprev = /^(?:parents|prev(?:Until|All))/
, isSimple = /^.[^:#\[\.,]*$/, POS = jQuery.expr.match.globalPOS, //
methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique =
{ children: true, contents: true, next: true, prev: true }; jQuery.fn.extend({ find: function( selector ) { var i, l,
length, n, r, ret, self = this; if ( typeof selector !== "string" ) { return jQuery( selector ).filter(function() { for ( i = 0, l = self.length; i < l; i++ ) { if
( jQuery.contains( self[ i ], this ) ) { return true; } } });
Kaan
Hi I have a question. I am writing a code that takes string input from user and if string is polindrom prints polidrom. I used for loop for reverse the string then I compared reversed string and normal string with strcmp. Everthing was fine up to this part but somethink went wrong after comparing whatever I choose for string strcmp returns -1
Kaan
Can anybody help?
Kaan
If it is okey I can paste my code
Kaan
void isPolidrom(char string[]){
int lenght=sizeof(string)*sizeof(string[0]);
char reversedStr[lenght];
int j=0;
for(int i=lenght-1;i>=0;i--){
reversedStr[j]=string[i];
j++;
}
printArray(reversedStr,lenght);
printf("%d\n",strcmp(string,reversedStr));
if(strcmp(string,reversedStr)==0){
printf("Polindrom");
}
else{
printf("Not polindrom");
}
}
Igor🇺🇦
How do you have a word without string? Depends on how you represent the word
Kaan
Did you used char array or just char
Emir
Kaan
Emir
u can pass "blablablablablabla" to function, and print the lenght
Kaan
Igor🇺🇦
You can use std container such as std::array or std::vector and use std::reverse.
Igor🇺🇦
What didn't you understand? Do you know what vector is? https://en.cppreference.com/w/cpp/container/vector
Do you know reverse algorithm? https://en.cppreference.com/w/cpp/algorithm/reverse?
Kaan
Tangent Alpha
Kaan
Kaan
KAAK
-1
Not polindrom//this is my first output I give a string named KAAK and printed reversed string which KAAK then compared with strcmp and I got -1
Kaan
NAAK
-1
Not polindrom//And this is my second output I named the string as KAAN and then program printed NAAK this is a proof my reverse part is working fine
Kaan
if(strcmp(string,reversedStr)==0){
printf("Polindrom");
}//This part in my code compares reversed string and string. I do not understand why it gives always -1
Emir
Igor🇺🇦
Mushe
/
Emir
Emir
Kaan
void isPolidrom(char string[],int size){
char reversedStr[size];
int j=0;
for(int i=size-1;i>=0;i--){
reversedStr[j]=string[i];
j++;
}
reversedStr[j+1]='\0';
printArray(reversedStr,size);
printf("%d\n",strcmp(string,reversedStr));
if(strcmp(string,reversedStr)==0){
printf("Polindrom");
}
else{
printf("Not polindrom");
}
}
Kaan
I changed my function but the it does not work
Emir
Kaan
Okey I think I understood the mistake. Strings has \0 in the end and when I reversed the string KAAK it wasnt "KAAK" it was " KAAK" because of the last character of the string
Mahir
PIC C/PROTEUS hi my circuit 16f84A I have 3 buttons I want the LED to light up from top to bottom when I press the 1st button, the LED will light up from the bottom when I press the 2nd button I want it to be in the form of a blink when I press the 3rd button. Can anyone help?
Al
bro this has really few to do with c , you can program a pic directly in assembler plus if you do it in C you really need to know about pic registers .. this question is related to embedded systems
Al
no pvt pls
Mahir
sorry
Al
my suggestion is to ask in another channel
Al
more related to your needs
Al
is plenty of iot and embedded system channels