Suka
neovim here! sometimes vscode.
yups by vim, i mean neovim hehehe.
Suka
What are your specs?
i5 2nd generation 12Gb ram. and slow hdd disk
Anonymous
hello
Anonymous
who can help me on c programming assigment? i can pay thank you !!!!
Yasas
i5 2nd generation 12Gb ram. and slow hdd disk
Ok. It's better than mine. I have i3 2nd gen 2gb ram and 512gb hard drive.
Yasas
Ok
Engineer
@lightness_races_in_orbit do you know of a tool that can point out undefined behavior in C code?
Engineer
Anyone using a Linux virtual machine and Clang / Clang++ ?
Engineer
https://blog.regehr.org/archives/213
Engineer
int32_t safe_div_int32_t (int32_t a, int32_t b) { if ((b == 0) || ((a == INT32_MIN) && (b == -1))) { report_integer_math_error(); return 0; } else { return a / b; } }
Anonymous
@lightness_races_in_orbit do you know of a tool that can point out undefined behavior in C code?
There is no tool that can identify all possible Undefined Behavior use cases. But compilers do provide a suite of tools that can help to a great extent. For ex Clang has a static analyzer, address sanitizer, thread safety checker, thread sanitizer, memory sanitizer, leak sanitizer, control flow integrity checker and so on. GCC offers a similar set of tools as well. They can help identify most of the problems between them.
Anonymous
Thanks! I am new to Linux. Do you suggest I go with GCC/G++ or Clang/Clang++
GCC is used by most of the companies. So if you learn it, it will be helpful. Clang has an amazing set of tools which would help you if you are a freelancer.
Engineer
What is your question here?
This uses an exit early/return early strategy, is this common in company standard coding styles or it depends on company requirements for coding standards? #edit of -> or typo
Anonymous
This uses an exit early/return early strategy, is this common in company standard coding styles or it depends on company requirements for coding standards? #edit of -> or typo
Yes it is also called fail fast strategy. Report an error where it occurs and exit early. It is mostly used to meet SLA between components. Within your own component, you must try to recover if possible.
Engineer
GCC is used by most of the companies. So if you learn it, it will be helpful. Clang has an amazing set of tools which would help you if you are a freelancer.
This is interesting. My cousin's friend is a compiler optimization writer and she introduced me to her online and was very kind to explain things that went over my head. She was of the opinion that clang/llvm is better suited for people new to C/C++ as it gives more information about the code. So this chimes with what you explained.
Anonymous
SLA? Not familiar with this acronym.
Service Level Agreements.
Mac
Alright y’all I have a tricky one at least for me: #include<stdio.h> int main(): { int x = 67, *m = &x; int *n = m; char *t = n; printf(“%c %d”, *t,*n); } Apparently the answer is: C 67, not sure why though. Here’s my thinking… m is a pointer to address of x. We then copy the address of x, which is stored by m, to *n so n now points to address of x. So no m and n point to address of x. Again we copy the address but this time we copy n to *t. Since t is a char, it prints out the ASCII value of C, n is int so prints out 67. Correct?
Mac
Which compiler are you using?
I’m actually not sure. I’m using visual studio as an ide
Engineer
I’m actually not sure. I’m using visual studio as an ide
Try your code in www.godbolt.org and choose different versions of compilers
Engineer
Service Level Agreements.
Not really sure what this means...
Mac
I’m actually not sure. I’m using visual studio as an ide
The compile error is ‘cannot convert from ‘int *’ to ‘char *’ and value type ‘int *’ cannot be used to initialize an entity of type ‘char *’
Mac
Did you try casting it?
I could probably cast it, but is how the problem was presented. Maybe it is implicit casting. It’s funny because the only two answers in the multiple choice it could be are either C 67 or compiler error damn it lol
Anonymous
Not really sure what this means...
This is usually agreements on stuff like number of arguments, types of arguments, the value types representing the arguments, the return value types, whether it is an async operation or a blocking operation, the time of execution, performance metrics, HA tier and so on. These are common when you get into SOA (Services Oriented Architecture), Microservices and Component development. So in SLA, there might even be a requirement to Fail fast or Fallback recovery and so on. Depending on these, your services or components must strive to meet these requirements and when you dont it is considered a contract breach.
Anonymous
Alright y’all I have a tricky one at least for me: #include<stdio.h> int main(): { int x = 67, *m = &x; int *n = m; char *t = n; printf(“%c %d”, *t,*n); } Apparently the answer is: C 67, not sure why though. Here’s my thinking… m is a pointer to address of x. We then copy the address of x, which is stored by m, to *n so n now points to address of x. So no m and n point to address of x. Again we copy the address but this time we copy n to *t. Since t is a char, it prints out the ASCII value of C, n is int so prints out 67. Correct?
Casting to a char* is ok but this is implementation defined. From your example output it seems you were using a little endian system where the least significant bytes are stored first followed by the more significant bits. So when you cast this int pointer to a char pointer, the char pointer points to the byte that holds the value 67. So this is printed as 'C' because its ASCII value is 67 (assuming that is the basic character set encoding on that machine). If you tried the same program on a big Endian system, the output would be '\0' 67. This is why it is called Implementation defined. The cast though legal, still requires a casting operation to be used. The compiler wont implicitly convert a int* pointer to a char* pointer unless you tell it that it is safe to do so.
drinktoomuch
how can i play audio file in C ??
Shourya
how can i play audio file in C ??
What do u want do to ...For audio programming use ALSA or Jack d or other frameworks ...If u just want to play a audio file launch the file using aplay or ffmpeg etc with system command
drinktoomuch
Well I want to just play a mp3 or wave file :vvv
Prince
Hello here,,I would like to do something best with my computer to earn a lot.kindly help me
ᴿᴵᴷ
I need help solving these questions
ᴿᴵᴷ
تہوتہايہه Write a C++ program to read two string and then find the longest string between them (with the large number of characters) then print it in a reverse order. * write a C++ program to apply a swap function among three numbers. You have to print the output in the main body of program. * (for example: a=3, b=6, c=9) the output of program should be like ( a=6, b=9, c=3)
Shourya
Well I want to just play a mp3 or wave file :vvv
Then use aplay with system in Linux or playsound on Windows
mito
please i need help
Be specific on which part of your code you need help with.
ᴿᴵᴷ
mito
If you are stuck in the middle of solving it , you can ask.
mito
I need help please
Is that your homework?
ᴿᴵᴷ
Is that your homework?
Yes, this is my duty after an hour for delivery
Anonymous
please i need help
Have u by any chance started writing at least 1 line of code?
Anonymous
I did not write
If u are not even writing a single line for your own problem , why should we help u?
Anonymous
please please help me
Looping the word "please" wont do... FYI.
Vitrag
I have done a program to multiply a matrix but I can just do 5x5 × 5x5 or same but I want to do 2x3 × 3x2 how should I do that
Vitrag
Can anyone help me im new to c++
Vitrag
Can I copy paste that here
Anonymous
Can I copy paste that here
Put it on pastebin.com and post the link here.
Vitrag
https://pastebin.com/rh2rQk2T
Anonymous
https://pastebin.com/rh2rQk2T
You are accepting only one input n. Instead accept three inputs n,m,k and ask the user to input m*(n+k) elements instead of 2*n*n elements to form two matrices n×m and mxk matrix. Now you can display these 2 matrices with 2 for loops - the outer for loop iterating from 0 to n and the inner for loop iterating from 0 to m for the first matrix and likewise for the second matrix. Now for the multiplication, all your 3 for loop indexes range from 0 to n. You have to change it so that the first for loop ranges from 0 to n, the second from 0 to m and the third from 0 to k. You would have a n*k matrix as a result of the multiplication.
Suka
I have done a program to multiply a matrix but I can just do 5x5 × 5x5 or same but I want to do 2x3 × 3x2 how should I do that
try with small matrix first and calculate by your own hand. until you understand the algorithms(concept) and translate to code. goodluck
Anonymous
Should I use learncpp.com to start cpp i practiced in c now I want to switch to cpp ?
Mohammad Taha
Do we have something equivalent to [DllImport("")] I have seen this in csharp samples and want to add "user32.dll" into my app
Vitrag
Why do some compiler uses (int main) instead of (void main )
ICEBERG 🧊🧊🧊
Write a C++ application to find the mean of 1. even numbers 2. non even numbers 3.multiples of 5 from numbers between 1 and 100. Note the you are to use just a single loop and for that a single program for this task.
ICEBERG 🧊🧊🧊
any help?