printf segment error (core dump): a problem caused by formatted output

1. printf segment error (core dump): a problem caused by formatted outputPost a simple example:#include <stdio.h> int main(){ int len = sizeof(int); printf("%s\n",len); return 0; } `root@ubuntu:test#gcc test.c test.c: In function 'main':test.c:5:2: warning: format '%s' expects argument of type 'char *', but argument 2 has typ ...

Posted by anthill on Mon, 28 Feb 2022 02:45:27 +0100

Java Basics: console input (Scanner) and output (print, println, printf)

1. Console input (Scanner) 1.1 Scanner object java.util.Scanner is a new feature of Java 5. We can get user input through scanner class. The following is the basic syntax for creating Scanner objects: Next, we demonstrate the simplest data input and obtain the input string through the next() and nextLine() methods of the Scanner cla ...

Posted by mwkemo on Fri, 31 Dec 2021 20:57:10 +0100