Edy
Hello, masters of bits. Im mad a bit, could someone help me with pointer arithmetic? char S2[100] = {}; char *start, *end; .... char *l = &S2[0] + start + sizeof("MEH") - 1; .... invalid operands to binary + (have ‘char *’ and ‘char *’) why i can't get that adress?
First S2[100] is an array of char... We usually use such array to store string in C because we dont have the string data type in C. Char *start is a pointer to a char meanning that the start Variable points to an adress .... The difference between char *start and char S2[100] is that they store different thing .... And even in real life you cannot mix Oil with water .... Therefore you need to do some Memory allocation.....
Anonymous
State whether the following are VALID 0r INVALID statement in C++. (8 marks) i. x = 12; ii. 12 = x; iii. y +y = x; iv. y = x + 12;
Anonymous
if u know it guys, pls help..
Tushar
Valid Invalid Valid Valid
Mr
State whether the following are VALID 0r INVALID statement in C++. (8 marks) i. x = 12; ii. 12 = x; iii. y +y = x; iv. y = x + 12;
Damn that's too easy that a kid can solve, I think that guy was not a kid into his childhood.
Anonymous
I hope you will enjoy it 😭
alessandro
what is the best library to make two devices comunicate? ( i mean if someone know the implementation of tcp for avr )
Jose
what is the best library to make two devices comunicate? ( i mean if someone know the implementation of tcp for avr )
How we can infere from your comment you are talking about firmware and microcontrollers? A PC is a device, too
Jose
There is no "communication library" in firmware. There is no OSI models, neither partial OSI models, nor routers, nor switches, nor cross cables (except for rs232). Only there is-at hardware level- the OSI level 0: the communication -bitbanging protocols- istelf. TCP doesn't have any sense at uC communications. It has a bunch of protocols at various OSI leves and, for example, serial protocol (rs232) doesn't have any. I2C doesn't have, too. SPI? Of course not. That's why there is no "best" library, because there is no library
Dm
Valid Invalid Valid Valid
Why 3 is valid? y+y is lvalue
Dm
y + (y=x)
Ok. It will correct only with brackets, right?
klimi
Ok. It will correct only with brackets, right?
no... it's the same as y+y=x
Dm
I thought that + has higher priority and this make it wrong
klimi
oh right. i am wrong
klimi
with () it should work thought
Dm
I agree
Tushar
Why 3 is valid? y+y is lvalue
Sorry My bad valid invalid invalid valid
Tushar
y + (y=x)
Yes but this is a valid expression
Dima
please, use pastebin, its really uncomfortable to read this code in this tg chat
Dima
rules
B4H
<script src="https://pastebin.com/embed_js/kTSAjEiS?theme=dark"></script>
B4H
Can anyone help me with the idea of copy construcor in this code
B4H
computer(long c, CPU cp, MEMORY& m, bool u, IO& i) :cost(c), cpu(cp), io(i), used(u), memory(m)
B4H
this is the line im intrested in
Sarmat
Can anyone help with build Assimp to Android please?
Gregory
Can I share a YouTube channel about programming lessons?
the best for everyone
// swap first and last digit of a given number #include <stdio.h> #include <math.h> int main(){ int number ,lastDigit , digitsCount , firstDigit ; printf("Enter a number to swap first and last digit of number|"); scanf("%d",&number); digitsCount = (int)log10(number); // its a function // its used to ease and find count of the digits firstDigit=number/ pow(10,digitsCount); lastDigit=number%10; // //Swapping the first digit and last digit. int x = firstDigit * (pow(10, digitsCount)); int y = number % x; number = y / 10; }
the best for everyone
I have a en error in this code and i couldn't solve it
Ilya
I have a en error in this code and i couldn't solve it
There are no compiler errors in your code
labyrinth
does assigning {0} to a char[X] zeros the memory?
\Device\NUL
does assigning {0} to a char[X] zeros the memory?
If you define some of array member, the rest that uninitialized Will be zeroed
\Device\NUL
What's the difference between WriteFile and WriteConsole on win32 API ?
Francisco
Hi. How can we change the font color of a specific portion of text to be displayed in a c program?
\Device\NUL
Plz don't pm @gunners1014
Anonymous
hi bro, i have a program. only one cpp file. who can help me static release pack.
🇺🇸
Hello everyone Can someone tell me what’s wrong here
Francisco
And if i want to asign the content of a string to another string how can i do??
ahmet
read integers N(>=3) ,then read N integers.Find the lowest 3 numbers .input(5 ,4 1 3 10 8 ) output 1 3 4 . this is a question with solution i didn't understand the code #include<iostream> using namespace std; int main() { int n, tmp, mn[3]; cin >> n; for (int i = 0; i < n; i++) { int value; cin >> value; if (i < 3) mn[i] = value; else { // Find maximum position int mx_pos = 0; for (int j = 1; j < 3; ++j) { if (mn[mx_pos] < mn[j]) mx_pos = j; } if (value < mn[mx_pos]) mn[mx_pos] = value; } } // let's order the first 3 values. We can do in several ways // Find maximum position int mx_pos = 0; for (int j = 1; j < 3; ++j) { if (mn[mx_pos] < mn[j]) mx_pos = j; } // swap max with last tmp = mn[2]; mn[2] = mn[mx_pos]; mn[mx_pos] = tmp; // Swap first 2 elements if needed if (mn[0] > mn[1]) { tmp = mn[0]; mn[0] = mn[1]; mn[1] = tmp; } for (int i = 0; i < 3; i++) cout << mn[i] << " "; // not ordered return 0; }
🇺🇸
Hello everyone Can someone tell me what’s wrong here
#include <iostream> using namespace std; int function(int x, int y) { return (x - (x == y)); } int main() { int a = 25, b = 24 + 1, c; cout << function(a, b); return 0; }
🇺🇸
Nothing wrong, what you expect ?
But program doesn’t work
\Device\NUL
\Device\NUL
Why the heck you guys are pm-ing
\Device\NUL
This groups is exists, doesn't need to pm
\Device\NUL
Or input three integers, and then compare the rest of input if could be swapped
the best for everyone
#include <stdio.h> #include <stdbool.h> int count_unique(const int a[] , int length); int count_unique(const int a[] , int length){ int counter=0; for (int i = 0; i < length; i++) { bool matchFund= false; for (int j = 0; j < length; j++) { if (a[i] == a[j] && i!=j) matchFund = true; if (!matchFund) counter++; } } } int main(){ int a[]= {1,2,3,4,5,6,3,4,1,8,9,7,8}; // int length; // printf("Enter the length"); // scanf("%d",&length); int total_length= count_unique(a , 13); printf("the total Unique elements length is %d",total_length); return 0; }
Francisco
strcpy
I guess i'll have to use the library string.h
Iwan
#include <iostream> using namespace std; int function(int x, int y) { return (x - (x == y)); } int main() { int a = 25, b = 24 + 1, c; cout << function(a, b); return 0; }
the return value of that function is x - (x==y)) x==y is condition true because x=25 same as y=25. Then return value must x-(true) = (x-1)
Anonymous
how to learn C language as a beginner?
Francisco
how to learn C language as a beginner?
Seriously how can we do this so as to become as marvelous as you people??
Anonymous
best question and best answer exactly
kww
stackoverflow before your eyes
Anonymous
I think it's easier to learn C than to write a question on Stack Overflow😂
Fr
What do (char c=45 ) mean?
UrCodeBuddy️ 💻
U have a variable c and ur assigning the value 45
Fr
ASCII
Ascci of 45?
Arvin
45 of ASCII
Fr
Right?
kww
Ascci of 45?
as we know char represents a single character such as letter 'a' or the digit character '5' but you can also use the numerical code to assign values char c = 45; // ASCII
kww
but its poor style
Francisco
void bubble_sort(float array[100], int size){ int i, j, t; for(i=0; i<size; i++){ for(j=0; j<size; j++){ if(array[j]>array[j+1]){ t=array[j]; array[j]=array[j+1]; array[j+1]=t; } } } for(i=0;i<size;i++){ printf("%d. %.2f\n",i+1, array[i]); } }
Francisco
Please what's the problem in this piece of code?
Anonymous
u have folat array, but created variable t integer
Francisco
float to int?
Ohh ya thanks i see
Persia
What is auto constant?