Answers for "cast number in c"

22

string to int c

atoi(str) is unsafe

This is the prefered method:
(int)strtol(str, (char **)NULL, 10)
Posted by: Guest on May-08-2020
2

casting in c

#include <stdio.h>
#include <stdlib.h>
int main(){
  int x = 7, y = 5;
  float z;
  z = (float)x / (float)y;   /*Here the value of z is 1.400000*/
  return 0;
}
Posted by: Guest on May-17-2020
1

how to cast in c programming

(new_type) name_var;
Posted by: Guest on April-25-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language