]> andersk Git - splint.git/blobdiff - test/chararraylit.c
Added chararrylit test case.
[splint.git] / test / chararraylit.c
diff --git a/test/chararraylit.c b/test/chararraylit.c
new file mode 100644 (file)
index 0000000..057a42f
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+** Character arrays can be initialized using string literals (without becoming observers).
+*/
+
+void f (void)
+{
+  char s0[] = "abc";
+  char s1[3] = "abc"; /* warning about no room for nullterminator */
+  char *p = "abc";
+
+  *s0 = 'b'; /* okay */
+  s1[1] = 'd'; /* okay */
+  *p = 'c'; /* error */
+}
This page took 0.034038 seconds and 4 git commands to generate.