Ruslan
Why can't I use functions like memset_s() and snprintf_s() even though stdio.h and string.h are included?
Ruslan
What error do you get?
undefined reference, it looks like I have no libraries, but why? Aren't these standard functions since c11?
Ruslan
Maybe your libc version is too old
I've tried to compile using GCC 10 and Clang 11
Nameful
I've tried to compile using GCC 10 and Clang 11
Are you using a build system or some sort of IDE?
Nameful
Or just invoking the compiler directly?
Ruslan
Nameful
Cmake, QtCreator
Could you send your CMakeLists.txt?
Anonymous
No effect, still undefined reference
https://stackoverflow.com/questions/47867130/stdc-lib-ext1-availability-in-gcc-and-clang
Ruslan
Could you send your CMakeLists.txt?
cmake_minimum_required(VERSION 3.5) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS OFF) project(C_test LANGUAGES C) include_directories(./include) add_executable(C_test ./src/main.c ./src/list.c ./include/list.h)
Ruslan
Now I've tried to set CMAKE_C_EXTENSIONS to ON, but it is still is not compiling.
Anonymous
https://stackoverflow.com/questions/47867130/stdc-lib-ext1-availability-in-gcc-and-clang
Did you read the Stackoverflow link I posted here : https://t.me/programminginc/422856 It says that the bounds checking functions support is poor in GCC and Clang. So it is most likely they are not available on your implementation
Anon
Hello
Anon
Can someone help me make a program for caesar cipher ?
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Can someone help me make a program for caesar cipher ?
A program that encrypts or decrypts messages using Caesar cipher?😄
Anon
I want to make it without ascii
\Device\NUL
wha
klimi
I want to make it without ascii
Like... Without using letters? Impossible
\Device\NUL
How ?
Anon
Yes with letters
klimi
Yes with letters
Letters are ascii
Anon
But without numbers
Anon
>=A && <=Z
klimi
Yeah... You seem to have the grasp of it
klimi
Keep going
Anon
But how i will go from A to Z and from Z to A?
Anon
Any example
klimi
But how i will go from A to Z and from Z to A?
Well I think A and Z are 26 letters apart
klimi
So you just 26 to A
Victor
But how i will go from A to Z and from Z to A?
A to Z for (ch = 'A'; ch <= 'Z'; ++ch) Z to A for (ch = 'Z'; ch >= 'A'; --ch)
Victor
The thing is that it only works in A-Z consecutive encoding, e.g. ASCII-compatible encoding.
Victor
If you use EBCDIC encoding, it doesn't work at all
Shubh
How to use ternary operator swaping two number
Shubh
Any one help me
Shubh
Please
Shubh
what ?
Swapping two number using ternary operator.
\Device\NUL
Swapping two number using ternary operator.
https://www.quora.com/How-do-I-swap-two-numbers-using-ternary-operation?share=1
Ammar
https://www.quora.com/How-do-I-swap-two-numbers-using-ternary-operation?share=1
There is a bug here ((c=a)?(a=b)&&(b=c):(a=b)&&(b=c)); Note that the operator && must short circuit, thus if a=b yields falsy value (zero), the second operand (b=c) won't be evaluated. Try this one: a = X b = 0 X can be any non-zero number. Will result in a = 0 and b = 0 (wrong). Expected result: a = 0 and b = X The b won't be equal to X because (b=c) is not evaluated.
mito
Why would you do that?
school stuff I guess.
Anonymous
Swapping two number using ternary operator.
Ternary operator means operator that work on three variables hmmm.. Why not condition operator like (a>b? a:b);
Anonymous
Hi all, Anyone help me here for below one . Input array 2 1 5 3 11 7 to Output array .2 7 3 11 1 5 If anyone know the behind logic, please share here. Thanks to everyone.
klimi
Why?
You don't need to increment each letter to get 'Z'... You can just increment by 26 to get it
Idrees
Hi, dear my name is Edrees I'm from Afghanistan and I'm an undergraduate at Nangarhar computer science University
Shayan
Hello
Shayan
#include <iostream> using namespace std; int search(int* arr, int size, int element) { for(int i=0; i<size; ++i) { cout<<i<<endl; if(arr[i] == element) return i; } return -1; } int main() { int size=10, searchElement=0, resultIndex=0; int* arr = new int[size]; int num=1; for(int i=0; i<size; ++i) { arr[i] = i+1; cout<<"Array element["<<i<<"] : "<<i+1<<endl; } cout<<"Enter the number you want to search: "; cin>>searchElement; resultIndex = search(arr, size, searchElement); if(resultIndex == -1) cout<<"Element not found! "<<endl; else cout<<"Element found at index: "<<resultIndex<<endl; return 0; }
Shayan
I have to count iteration in this program how to count it?
Shayan
Anyone help me?
Shayan
The topic is Linear search Binary search Data structure & algorithm C++
\Device\NUL
Please do not PM Shayan
Luca
guys, simple question just to be sure
\Device\NUL
I have to count iteration in this program how to count it?
just print the iteration output before return the value
バレンタインがいない柴(食用不可)
Morning
\Device\NUL
but how to count total iteration done in this program?
just put std::cout >> "Bla-bla iteration" >> i before return the value
Luca
if I've to calculate the result of a boolean expression such as: RESULT = A AND B OR C OR D The result would be the same independently by the order of the operation?
Anonymous
yo boys, is there a way to make this even more compact? (no need to add nothing, or fix syntax or leakage etc etc)
Anonymous
int main(int argc, char* argv[]){ for(size_t i = 1; i < argc; i++){ for(size_t b = 1;b < argc; b++){ if(strtol(argv[i],NULL,10) > strtol(argv[b],NULL,10)){ printf("%s nice(greater than %s)!!\n",argv[i],argv[b]); } } } return 0; }
Anonymous
probably not and i don't think there's any need to
just 4fun really, throwing it out there to see if I learn about something obscure and interesting that could be applied ya know